Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
483 | 关清声 | 最大公约数(函数) | C++ | Accepted | 0 MS | 268 KB | 288 | 2022-08-24 10:10:13 |
#include<iostream> using namespace std; int pd(int i,int x,int y) { if(x%i==0&&y%i==0) { return 1; } else { return 0; } } int main() { int a,b,c; cin>>a>>b; for(int i=a;i>=1;i--) { if(pd(i,a,b)==1) { cout<<i; return 0; } } return 0; }