解题思路:
注意事项:
参考代码:
#include<iostream> #include<cstdio> #include<string> #include<cmath> using namespace std; int main() { int m, n; cin >> m >> n; for (int i = m * n; i >= 1; i--) { if (m%i == 0 && n%i == 0) { cout << i <<" "; break; } } for (int i = 1; i <=m*n; i++) { if (i%m == 0 && i%n == 0) { cout << i << endl; break; } } getchar(); getchar(); return 0; }
0.0分
0 人评分