原题链接:http://acm.njupt.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1015
以此纪念我的第一篇博文。Fighting!!!
#include <iostream>
using namespace std;
class a
{
private:
int m,n,max,min;
public:
a(int i,int j){m=i;n=j;}
~a(){}
void judge()
{
if(m>n)
{
max=m;
min=n;
}
else{max=n;min=m;}
}
int yue()
{
if(m%min==0&&min==0)
{
return min;
}
else
{
while(m%min!=0||n%min!=0)
min--;
}
return min;
}
int bei(){
if(max%m==0&&max%n==0)
return max;
else{
while(max%m!=0||max%n!=0)
{
max++;
}
}
return max;
}
};
int main()
{
int i,j;
cin>>i>>j;
a o(i,j);
o.judge();
cout<<o.yue()<<" "<<o.bei()<<endl;
return 0;
}