Pagini recente » Cod sursa (job #349135) | Cod sursa (job #1944180) | Cod sursa (job #2243115) | Cod sursa (job #2511687) | Cod sursa (job #2262345)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("multiplu.in");
ofstream fout ("multiplu.out");
int a,b;
long long divv,m;
int cmmdc (int a,int b)
{
int r;
while(b)
{
r=a%b;
a=b;
b=r;
}
return a;
}
bool valid(int x)
{ int ok=1;
//cout<<"x="<<x<<endl;
while(x)
{
if(x%10!=0 && x%10!=1)
ok=0;
x/=10;
}
//cout<<"ok="<<ok<<endl;
return ok;
}
long long verif()
{
int ok=0,i=1;
while(!ok)
{
if(valid(m*i)) ok=true;
i++;
}
return m*(i-1);
}
int main()
{
fin>>a>>b;
m=(a*b)/cmmdc(a,b);
fout<<verif();
return 0;
}