Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
94052 | 林嘉乐 | 15求两个数的最大公约数 | C++ | Wrong Answer | 1 MS | 256 KB | 293 | 2024-10-19 17:36:01 |
#include<iostream> #include<iomanip> using namespace std; int main(){ int a,b,gcd; a=15; b=18; if(a>b){ gcd=b; } else{ gcd=a; } while(gcd>1){ if(a%gcd==0&&b%gcd==0){ break; } gcd--; } cout<<gcd<<endl; return 0; }
------Input------
49 47
------Answer-----
1
------Your output-----
3