aboutsummaryrefslogtreecommitdiff
path: root/test/012_math_permsign
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-07-04 17:09:55 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-07-04 17:09:55 +0200
commit518d98ad5f9eec0cf4124375bdbb84d1296b3f3f (patch)
tree467b2b0387f23a0b379cf428c6883937ec18c134 /test/012_math_permsign
parent425eee24421bf0a19c7e0199d2e3ecba3318c8f4 (diff)
downloadnissy-core-518d98ad5f9eec0cf4124375bdbb84d1296b3f3f.tar.gz
nissy-core-518d98ad5f9eec0cf4124375bdbb84d1296b3f3f.zip
(almost) added getcube
Diffstat (limited to 'test/012_math_permsign')
-rw-r--r--test/012_math_permsign/00_solved.in8
-rw-r--r--test/012_math_permsign/00_solved.out1
-rw-r--r--test/012_math_permsign/01_3cycle.in6
-rw-r--r--test/012_math_permsign/01_3cycle.out1
-rw-r--r--test/012_math_permsign/02_22swap.in13
-rw-r--r--test/012_math_permsign/02_22swap.out1
-rw-r--r--test/012_math_permsign/03_singleswap.in7
-rw-r--r--test/012_math_permsign/03_singleswap.out1
-rw-r--r--test/012_math_permsign/04_5ycle.in11
-rw-r--r--test/012_math_permsign/04_5ycle.out1
-rw-r--r--test/012_math_permsign/05_6ycle.in9
-rw-r--r--test/012_math_permsign/05_6ycle.out1
-rw-r--r--test/012_math_permsign/permsign_tests.c21
13 files changed, 81 insertions, 0 deletions
diff --git a/test/012_math_permsign/00_solved.in b/test/012_math_permsign/00_solved.in
new file mode 100644
index 0000000..54b5db0
--- /dev/null
+++ b/test/012_math_permsign/00_solved.in
@@ -0,0 +1,8 @@
17
20
31
42
53
64
75
86
diff --git a/test/012_math_permsign/00_solved.out b/test/012_math_permsign/00_solved.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/012_math_permsign/00_solved.out
@@ -0,0 +1 @@
0
diff --git a/test/012_math_permsign/01_3cycle.in b/test/012_math_permsign/01_3cycle.in
new file mode 100644
index 0000000..bfabfd6
--- /dev/null
+++ b/test/012_math_permsign/01_3cycle.in
@@ -0,0 +1,6 @@
15
20
34
41
53
62
diff --git a/test/012_math_permsign/01_3cycle.out b/test/012_math_permsign/01_3cycle.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/012_math_permsign/01_3cycle.out
@@ -0,0 +1 @@
0
diff --git a/test/012_math_permsign/02_22swap.in b/test/012_math_permsign/02_22swap.in
new file mode 100644
index 0000000..d0b0921
--- /dev/null
+++ b/test/012_math_permsign/02_22swap.in
@@ -0,0 +1,13 @@
112
20
31
48
53
65
74
86
97
102
119
1210
1311
diff --git a/test/012_math_permsign/02_22swap.out b/test/012_math_permsign/02_22swap.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/012_math_permsign/02_22swap.out
@@ -0,0 +1 @@
0
diff --git a/test/012_math_permsign/03_singleswap.in b/test/012_math_permsign/03_singleswap.in
new file mode 100644
index 0000000..42a584b
--- /dev/null
+++ b/test/012_math_permsign/03_singleswap.in
@@ -0,0 +1,7 @@
16
24
31
42
53
60
75
diff --git a/test/012_math_permsign/03_singleswap.out b/test/012_math_permsign/03_singleswap.out
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/012_math_permsign/03_singleswap.out
@@ -0,0 +1 @@
1
diff --git a/test/012_math_permsign/04_5ycle.in b/test/012_math_permsign/04_5ycle.in
new file mode 100644
index 0000000..630f6fa
--- /dev/null
+++ b/test/012_math_permsign/04_5ycle.in
@@ -0,0 +1,11 @@
110
20
31
46
52
63
74
85
97
108
119
diff --git a/test/012_math_permsign/04_5ycle.out b/test/012_math_permsign/04_5ycle.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/012_math_permsign/04_5ycle.out
@@ -0,0 +1 @@
0
diff --git a/test/012_math_permsign/05_6ycle.in b/test/012_math_permsign/05_6ycle.in
new file mode 100644
index 0000000..a226bae
--- /dev/null
+++ b/test/012_math_permsign/05_6ycle.in
@@ -0,0 +1,9 @@
18
26
30
41
53
62
74
85
97
diff --git a/test/012_math_permsign/05_6ycle.out b/test/012_math_permsign/05_6ycle.out
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/012_math_permsign/05_6ycle.out
@@ -0,0 +1 @@
1
diff --git a/test/012_math_permsign/permsign_tests.c b/test/012_math_permsign/permsign_tests.c
new file mode 100644
index 0000000..fa8ce9b
--- /dev/null
+++ b/test/012_math_permsign/permsign_tests.c
@@ -0,0 +1,21 @@
1#include "../test.h"
2
3int permsign(uint8_t *, int64_t);
4
5void run(void) {
6 char str[STRLENMAX];
7 uint8_t a[100];
8 int p;
9 int64_t n, i;
10
11 fgets(str, STRLENMAX, stdin);
12 n = atoll(str);
13
14 for (i = 0; i < n; i++) {
15 fgets(str, STRLENMAX, stdin);
16 a[i] = atoi(str);
17 }
18
19 p = permsign(a, n);
20 printf("%d\n", p);
21}

Generated with cgit - Back to sebastiano.tronto.net