diff options
| author | Richard Qin <richard.qin.001@gmail.com> | 2026-09-15 08:16:43 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.001@gmail.com> | 2026-09-15 08:16:43 +0800 |
| commit | 4022e5c95210631e4aceb08eaf9d9071aa5aefc4 (patch) | |
| tree | a5922559836e45fb3459a3d070367912e1035b1a /tests/sysy_lvX/104_long_array.sy | |
| download | rcc-master.tar.gz rcc-master.tar.xz | |
Diffstat (limited to 'tests/sysy_lvX/104_long_array.sy')
| -rw-r--r-- | tests/sysy_lvX/104_long_array.sy | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/sysy_lvX/104_long_array.sy b/tests/sysy_lvX/104_long_array.sy new file mode 100644 index 0000000..251117b --- /dev/null +++ b/tests/sysy_lvX/104_long_array.sy @@ -0,0 +1,61 @@ +const int N = 10000; + +int long_array(int k) { + int a1[N]; + int a2[N]; + int a3[N]; + int i = 0; + while (i < N) { + a1[i] = (i * i) % 10; + i = i + 1; + } + i = 0; + while (i < N) { + a2[i] = (a1[i] * a1[i]) % 10; + i = i + 1; + } + i = 0; + while (i < N) { + a3[i] = (a2[i] * a2[i]) % 100 + a1[i]; + i = i + 1; + } + int ans = 0; + i = 0; + while (i < N) { + if (i < 10) { + ans = (ans + a3[i]) % 1333; + putint(ans); + } + else if (i < 20) { + int j = N / 2; + while (j < N) { + ans = ans + a3[i] - a1[j]; + j = j + 1; + } + putint(ans); + } + else if (i < 30) { + int j = N / 2; + while (j < N) { + if (j > 2233) { + ans = ans + a2[i] - a1[j]; + j = j + 1; + } + else { + ans = (ans + a1[i] + a3[j]) % 13333; + j = j + 2; + } + } + putint(ans); + } + else { + ans = (ans + a3[i] * k) % 99988; + } + i = i + 1; + } + return ans; +} + +int main() { + return long_array(9); +} |
