aboutsummaryrefslogtreecommitdiff
path: root/rcc-legacy/tests/sysy_lvX/094_long_array.sy
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-06-08 17:10:31 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-06-08 17:10:31 +0800
commit72af0dedf9e18911da65b9a5c4906689e868d9fc (patch)
tree2ecbad93f96ab8ad7e26dc02cd02d802f853ab97 /rcc-legacy/tests/sysy_lvX/094_long_array.sy
parent8faf6d290d6703b1775e0ad7a8928a4ebea4b11b (diff)
downloadrcc-project-72af0dedf9e18911da65b9a5c4906689e868d9fc.tar.gz
rcc-project-72af0dedf9e18911da65b9a5c4906689e868d9fc.tar.xz
[legacy] Add functional and performance test suites
Diffstat (limited to 'rcc-legacy/tests/sysy_lvX/094_long_array.sy')
-rw-r--r--rcc-legacy/tests/sysy_lvX/094_long_array.sy61
1 files changed, 61 insertions, 0 deletions
diff --git a/rcc-legacy/tests/sysy_lvX/094_long_array.sy b/rcc-legacy/tests/sysy_lvX/094_long_array.sy
new file mode 100644
index 0000000..251117b
--- /dev/null
+++ b/rcc-legacy/tests/sysy_lvX/094_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);
+}