Pagini recente » Cod sursa (job #2220896) | Cod sursa (job #1471752) | Cod sursa (job #697978) | Cod sursa (job #1844346) | Cod sursa (job #263566)
Cod sursa(job #263566)
#include<stdio.h>
int cm(long a,long b)
{
if(a%b)
return a;
return cm(b,a%b);
}
char binn(long long s)
{
while(s)
{
if(s%10>1)
return 0;
s/=10;
}
return 1;
}
long long bun(long x)
{
long long ix=x,p=x;
while(binn(ix)==0)
ix+=p;
return ix;
}
int main()
{
freopen("multiplu.in","r",stdin);
freopen("multiplu.out","w",stdout);
long a,b,x;
scanf("%ld%ld",&a,&b);
x=a*b/cm(a,b);
printf("%lld",bun(x));
return 0;
}