Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158341 谭鑫哲 15求两个数的最大公约数 C++ Accepted 1 MS 280 KB 457 2026-08-21 10:19:53

Tests(10/10):


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,b,g; cin>>a>>b; if(a>b)g=b; else g=a; while(g!=0){ if(a%g==0&&b%g==0){ cout<<g; break; } g--; } return 0; }