aboutsummaryrefslogtreecommitdiff
path: root/test/010_math_permtoindex/permtoindex_tests.c
blob: 2a7ecf3dc29a7f8c187175fb2843e15be7e9da64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "../test.h"

uint64_t permtoindex(size_t n, const uint8_t *);

void run(void) {
	char str[STRLENMAX];
	uint8_t a[100];
	uint64_t n, i, p;

	fgets(str, STRLENMAX, stdin);
	n = atoll(str);
	for (i = 0; i < n; i++) {
		fgets(str, STRLENMAX, stdin);
		a[i] = (uint8_t)atoi(str);
	}

	p = permtoindex(n, a);
	printf("%" PRIu64 "\n", p);
}

Generated with cgit - Back to sebastiano.tronto.net