Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110207 王烁茗 最大公约数 C++ Accepted 1 MS 264 KB 496 2025-02-15 14:35:04

Tests(1/1):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a,s,q; cin>>a>>s; if (a>s) { q=s; } else { q=a; } for(q=q;a+s>q;q--) if(a%q==0&&s%q==0) { cout<<q; break; } return 0; }