Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
76572 sh25_zhuwy 求两个数的公约数 C++ 通过 0 MS 252 KB 330 2025-12-19 15:29:33

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int main() { int a,b,s=0,max; cin>>a>>b; if(a>b) { max=a; } else { max=b; } int k[max]; for(int i=1;i<=max;i++) { if(a%i==0&&b%i==0) { k[s]=i; s++; } } for(int i=0;i<s;i++) { cout<<k[i]<<" "; } cout<<endl<<s; return 0; }


测评信息: