diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-04 17:09:55 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-04 17:09:55 +0200 |
| commit | 518d98ad5f9eec0cf4124375bdbb84d1296b3f3f (patch) | |
| tree | 467b2b0387f23a0b379cf428c6883937ec18c134 /test/010_math_permtoindex/permtoindex_tests.c | |
| parent | 425eee24421bf0a19c7e0199d2e3ecba3318c8f4 (diff) | |
| download | nissy-core-518d98ad5f9eec0cf4124375bdbb84d1296b3f3f.tar.gz nissy-core-518d98ad5f9eec0cf4124375bdbb84d1296b3f3f.zip | |
(almost) added getcube
Diffstat (limited to 'test/010_math_permtoindex/permtoindex_tests.c')
| -rw-r--r-- | test/010_math_permtoindex/permtoindex_tests.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/010_math_permtoindex/permtoindex_tests.c b/test/010_math_permtoindex/permtoindex_tests.c new file mode 100644 index 0000000..98c8207 --- /dev/null +++ b/test/010_math_permtoindex/permtoindex_tests.c | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | int64_t permtoindex(uint8_t *, int64_t); | ||
| 4 | |||
| 5 | void run(void) { | ||
| 6 | char str[STRLENMAX]; | ||
| 7 | uint8_t a[100]; | ||
| 8 | int64_t n, i, p; | ||
| 9 | |||
| 10 | fgets(str, STRLENMAX, stdin); | ||
| 11 | n = atoll(str); | ||
| 12 | for (i = 0; i < n; i++) { | ||
| 13 | fgets(str, STRLENMAX, stdin); | ||
| 14 | a[i] = atoi(str); | ||
| 15 | } | ||
| 16 | |||
| 17 | p = permtoindex(a, n); | ||
| 18 | printf("%" PRId64 "\n", p); | ||
| 19 | } | ||
