Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78332 杨珞烯 15求两个数的最大公约数 C++ Accepted 0 MS 276 KB 223 2024-06-18 18:47:38

Tests(10/10):


Code:

#include <iostream> using namespace std; int main(){ int a,b,zd=0,n,s=1; cin>>a>>b; if(a<b){ n=a; }else{ n=b; } while(s<=n){ if(a%s==0&&b%s==0){ zd=s; } s++; } cout<<zd; return 0; }