diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-11-01 11:31:39 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-11-01 11:31:39 +0700 |
commit | dfaf87f8696bb31bc1a29b2d4a67f17ad1a2f593 (patch) | |
tree | b2cced929ddfa488f8dd9d871aed35266fe43f47 /THT/B | |
parent | 71a6e456b59171a681bccff7eeba9db7367bca37 (diff) | |
download | cp-dfaf87f8696bb31bc1a29b2d4a67f17ad1a2f593.tar.gz |
Thêm đề HSG lớp 9 TP Huế
Diffstat (limited to 'THT/B')
-rw-r--r-- | THT/B/QG-2016/trigrid.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/THT/B/QG-2016/trigrid.c b/THT/B/QG-2016/trigrid.c new file mode 100644 index 0000000..5b8606c --- /dev/null +++ b/THT/B/QG-2016/trigrid.c @@ -0,0 +1,30 @@ +#include <stdio.h> + + +const long long a[] = {4, 3, 5, 6, 111, 222, 3333, 4444, 55555, 666666, 7777777, + 88888888, 999999999, 123456789123456789, + 1000000000000000000}; + +long long quadratic(long long x, char a, char b, char c) +{ + return a * x * x + b * x + c; +} + +int main() +{ + char i; + long long k, q; + FILE *f; + + f = fopen("TRIGRID.TXT", "w"); + + for (i = 0; i < 15; i++) { + q = a[i] % 2016; + k = a[i] / 2016 % 2016 * 252 * quadratic(q, 6, 10, 2); + fprintf(f, "%d\n", (k + quadratic(q, 2, 5, 2) * q / 8) % 2016); + } + + fclose(f); + + return 0; +} |