aboutsummaryrefslogtreecommitdiff
path: root/old/2021-11-10-beforeremovingchecker/utils.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
commit3568412f8f230774d0d11d7ed1c897424f95d3ef (patch)
tree77223792d8c925a9b1fc32b3f4341e943b5f8209 /old/2021-11-10-beforeremovingchecker/utils.h
parent67e1b5e6e6a2c917a2fe58a37a1382c982b1e5c5 (diff)
downloadnissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.tar.gz
nissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.zip
Rewritten from scratch. Welocme nissy 2.0!
Diffstat (limited to 'old/2021-11-10-beforeremovingchecker/utils.h')
-rw-r--r--old/2021-11-10-beforeremovingchecker/utils.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/old/2021-11-10-beforeremovingchecker/utils.h b/old/2021-11-10-beforeremovingchecker/utils.h
new file mode 100644
index 0000000..80c33ae
--- /dev/null
+++ b/old/2021-11-10-beforeremovingchecker/utils.h
@@ -0,0 +1,41 @@
1#ifndef UTILS_H
2#define UTILS_H
3
4#include <stdbool.h>
5#include <stdlib.h>
6#include <string.h>
7
8#define POW2TO6 64ULL
9#define POW2TO11 2048ULL
10#define POW2TO12 4096ULL
11#define POW3TO7 2187ULL
12#define POW3TO8 6561ULL
13#define FACTORIAL4 24ULL
14#define FACTORIAL6 720ULL
15#define FACTORIAL7 5040ULL
16#define FACTORIAL8 40320ULL
17#define FACTORIAL12 479001600ULL
18#define BINOM12ON4 495ULL
19#define BINOM8ON4 70ULL
20#define MIN(a,b) (((a) < (b)) ? (a) : (b))
21#define MAX(a,b) (((a) > (b)) ? (a) : (b))
22
23void apply_permutation(int *perm, int *set, int n);
24int binomial(int n, int k);
25int digit_array_to_int(int *a, int n, int b);
26int factorial(int n);
27void index_to_perm(int p, int n, int *r);
28void index_to_subset(int s, int n, int k, int *r);
29void int_to_digit_array(int a, int b, int n, int *r);
30void int_to_sum_zero_array(int x, int b, int n, int *a);
31int invert_digits(int a, int b, int n);
32bool is_perm(int *a, int n);
33bool is_subset(int *a, int n, int k);
34int perm_sign(int *a, int n);
35int perm_to_index(int *a, int n);
36int powint(int a, int b);
37int subset_to_index(int *a, int n, int k);
38void sum_arrays_mod(int *src, int *dst, int n, int m);
39void swap(int *a, int *b);
40
41#endif

Generated with cgit - Back to sebastiano.tronto.net