Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
58575 | 王一涵(吃土豆长大的马铃薯) | 最大公约数和最小公倍数问题 | C++ | Accepted | 0 MS | 252 KB | 336 | 2024-12-12 17:16:44 |
#include<bits/stdc++.h> using namespace std; int gcd(int bcs,int cs){ int r=bcs%cs; while(r!=0){ bcs=cs; cs=r; r=bcs%cs; } return cs; } int main() { int x,y,cnt=0; cin>>x>>y; int num=x*y; for(int i=x;i<=sqrt(num);i++){ if(num%i==0&&gcd(i,num/i)==x) cnt+=2; } cout<<cnt; return 0; }