| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 84300 | 陈俊洁 | 最大公约数(函数) | C++ | Wrong Answer | 1 MS | 268 KB | 336 | 2024-07-15 15:08:42 |
#include<bits/stdc++.h> using namespace std; int gcd(int n,int m) { for(int i=n; i>0; i--) { if(n%i==0&&m%i==0) { return i; } } } int gcd2(int n, int m) { int c=n%m; while(c!=0) { n=m; m=c; c=n%m; } return m; } int main() { int a,b; cin>>a>>b; cout<<gcd(a,b)<<endl; cout<<gcd2(a,b)<<endl; }
------Input------
49 47
------Answer-----
1
------Your output-----
1 1