Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
24374 | 老方 | 求最大公约数问题 | C++ | Accepted | 0 MS | 240 KB | 224 | 2023-08-11 14:47:15 |
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,s=0; cin>>a>>b; if(a<b){ int t=a; a=b; b=t; } for(int i=1;i<=b;i++){ if(a%i==0 && b%i==0){ s=i; } } cout<<s; return 0; }