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

int64_t permtoindex(size_t n, const uint8_t [n]);

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

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

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

Generated with cgit - Back to sebastiano.tronto.net