Pagini recente » Cod sursa (job #109960) | Cod sursa (job #2926767) | Cod sursa (job #928018) | Cod sursa (job #3283924) | Cod sursa (job #115020)
Cod sursa(job #115020)
#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;
}