aboutsummaryrefslogtreecommitdiff
path: root/rcc-legacy/tests/upload/gcd.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/upload/gcd.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/upload/gcd.sy')
-rw-r--r--rcc-legacy/tests/upload/gcd.sy42
1 files changed, 42 insertions, 0 deletions
diff --git a/rcc-legacy/tests/upload/gcd.sy b/rcc-legacy/tests/upload/gcd.sy
new file mode 100644
index 0000000..881c52d
--- /dev/null
+++ b/rcc-legacy/tests/upload/gcd.sy
@@ -0,0 +1,42 @@
+int gcd1(int m,int n)
+{
+ int t,r;
+ if (m<n)
+ {
+ t=m;
+ m=n;
+ n=t;
+ }
+
+ while((m%n)!=0)
+ {
+ r=m%n;
+ m=n;
+ n=r;
+ }
+
+ return n;
+}
+
+int gcd2(int x, int y)
+{ if (y!=0)
+ return gcd2(y, x%y);
+ else
+ return x;
+}
+int main(){
+ int num=getint();
+ while(num>0){
+ int m=getint();
+ int n=getint();
+ int t1=gcd1(m,n);
+ int t2=gcd2(m,n);
+ putint(t1);
+ putch(10);
+ putint(t2);
+ putch(10);
+ num=num-1;
+ }
+
+ return 0;
+} \ No newline at end of file