aboutsummaryrefslogtreecommitdiff
path: root/test/010_math_permtoindex/permtoindex_tests.c
blob: 98c8207fa55c292e6bbb220c1a457d897e194feb (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(uint8_t *, int64_t);

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(a, n);
	printf("%" PRId64 "\n", p);
}

Generated with cgit - Back to sebastiano.tronto.net