题解 | 复杂的最大公约数
复杂的最大公约数
https://www.nowcoder.com/practice/992a24ff72be4991bf099ae681bec68b
void __Main__(){
string a,b; cin>>a>>b;
if(a==b) return cout<<a<<endl, void();
cout<<1<<endl;
}
注意到 gcd(a+1, a) = gcd(a, 1) = gcd(1, 0) = 1,所有只有输入的两个数相同时答案为其本身,否则答案是 1

查看7道真题和解析