aboutsummaryrefslogtreecommitdiff
path: root/tests/upload/matrix_matrix.sy
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.001@gmail.com>2026-09-15 08:16:43 +0800
committerRichard Qin <richard.qin.001@gmail.com>2026-09-15 08:16:43 +0800
commit4022e5c95210631e4aceb08eaf9d9071aa5aefc4 (patch)
treea5922559836e45fb3459a3d070367912e1035b1a /tests/upload/matrix_matrix.sy
downloadrcc-master.tar.gz
rcc-master.tar.xz
Set up a git repoHEADmaster
Diffstat (limited to 'tests/upload/matrix_matrix.sy')
-rwxr-xr-xtests/upload/matrix_matrix.sy58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/upload/matrix_matrix.sy b/tests/upload/matrix_matrix.sy
new file mode 100755
index 0000000..964a681
--- /dev/null
+++ b/tests/upload/matrix_matrix.sy
@@ -0,0 +1,58 @@
+int matrix1[100][100];
+int matrix2[100][100];
+int result[100][100];
+
+void calculate(int n, int m, int k)
+{
+ int i = 0;
+ int j = 0;
+ int temp = 0;
+ int p = 0;
+ while (i < n)
+ {
+ j = 0;
+ while (j < k)
+ {
+ p = 0;
+ temp = 0;
+ while (p < m)
+ {
+ temp = temp + matrix1[i][p] * matrix2[p][j];
+ p = p + 1;
+ }
+ result[i][j] = temp;
+ j = j + 1;
+ }
+ i = i + 1;
+ }
+ return;
+}
+
+int main()
+{
+ int i = 0;
+ int n;
+ int m;
+ int k;
+ n = getint();
+ while (i < n)
+ {
+ m = getarray(matrix1[i]);
+ i = i + 1;
+ }
+ i = 0;
+ while (i < m)
+ {
+ k = getarray(matrix2[i]);
+ i = i + 1;
+ }
+ calculate(n, m, k);
+ i = 0;
+ while (i < n)
+ {
+ putarray(k, result[i]);
+ putch(10);
+ i = i + 1;
+ }
+ return 0;
+} \ No newline at end of file