Pagini recente » Cod sursa (job #2366222) | Cod sursa (job #1822960) | Cod sursa (job #2793317) | Cod sursa (job #1349606) | Cod sursa (job #115021)
Cod sursa(job #115021)
#include <cstdio>
FILE *in = fopen("multiplu.in","r"), *out = fopen("multiplu.out","w");
int x, y;
int cmmdc(int a, int b)
{
if ( b == 0 )
return a;
return cmmdc(b, a % b);
}
int ok(long long p)
{
while ( p )
{
int k = p % 10;
if ( k != 1 && k != 0 )
return 0;
p /= 10;
}
return 1;
}
int main()
{
fscanf(in, "%d %d", &x, &y);
long long k = (x*y) / cmmdc(x, y);
long long t = 2;
while ( !ok(k) )
{
k = k / (t-1);
k = k * t;
++t;
}
fprintf(out, "%lld\n", k);
return 0;
}