总时间限制:
1000ms
内存限制:
65536kB
描述
Given D and M. D is the divisor of both A and B, while M is the multiple of both A and B. Find A and B.
输入
Two positive integer D and M (D,M <= 100).
输出
Two integers A and B.
样例输入
3 18
样例输出
6 9
#include<bits/stdc++.h>//Writed by Wangzhimin Date:2022.06.06
using namespace std;
int main()
{
int m,n,a,b;
scanf("%d%d",&m,&n);
for(int i=2*m;;i++)
if(n%(i)==0){
a=i;
break;}
for(int i=a+m;;i=i+m)
{
if(n%i==0)
{
b=i;
break;
}
}
cout<<a<<" "<<b;
return 0;
}