Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
11784 徐一喆 最大公约数和最小公倍数 C++ Accepted 1 MS 732 KB 263 2021-05-17 18:07:23

Tests(1/1):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int i,x,y; cin>>x>>y; if(x>y) swap(x,y); for(i=y;i>=1;--i) if(x%i==0&&y%i==0){ cout<<i<<" "; break; } for(i=y;;i+=y) if(i%x==0) break; cout<<i<<endl; return 0; }