Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149655 肖之睿 15求两个数的最大公约数 C++ Accepted 1 MS 272 KB 320 2026-03-15 15:28:34

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a; int b; cin>>a>>b; if(a>b) { int t=a; a=b; b=t; } if(a%b==0){ cout<<b; return 0; } for(int i=b;i>=1;i--){ if(a%i==0&&b%i==0){ cout<<i; return 0; } } }