Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
26867 | 唐心 | 最大公约数和最小公倍数 | C++ | Accepted | 2 MS | 732 KB | 360 | 2022-05-24 17:16:50 |
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int a,b; int gcd(int n,int m) { int t = 0; while(m!=0) { t = n%m; n = m; m = t; } return n; } int fun(int n,int m) { return n*m/a; } int main() { int n,m; cin>>n>>m; a = gcd(n,m); b = fun(n,m); cout<<a<<" "<<b<<endl; return 0; }