Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
1241 | 李翼 | 15求两个数的最大公约数 | C++ | Accepted | 0 MS | 264 KB | 196 | 2023-08-23 10:14:56 |
#include<iostream> using namespace std; int main(){ int a,s,d=0; cin>>a>>s; if(a>s) d=s; else d=a; while(d>1){ if(a%d==0&&s%d==0) break; d--; } cout<<d; return 0; }