1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 using namespace std;
 5 int GCD(int a,int b)
 6 {
 7     for(;a>0&&b>0;a>b?a%=b:b%=a);
 8     return a+b;//最大公约数;
 9 }
10 int main()
11 {
12     int a,b;
13     while(cin>>a>>b)
14     {
15         int ans=GCD(a,b);
16         cout<<ans<<endl;
17         cout<<a*b/ans<<endl;//最小公倍数;
18     }
19     return 0;
20 }
View Code

相关文章:

  • 2021-06-04
  • 2022-12-23
  • 2021-06-14
  • 2021-07-11
猜你喜欢
  • 2022-01-21
  • 2022-02-03
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案