Cod sursa(job #286947)
| Utilizator | Data | 24 martie 2009 12:45:34 | |
|---|---|---|---|
| Problema | Multiplu | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <fstream>
using namespace std;
ifstream f("multiplu.in");
ofstream g("multiplu.out");
long a[30002]={1},x,y,cm;
int i,j,k=0;
long cmmdc(long x,long y)
{
while(x!=y)
((x>y)?(x-=y):(y-=x));
return x;
}
int main()
{
f>>x>>y;
cm=((x*y)/cmmdc(x,y));
for(i=0;i<=k;i++)
{
a[++k]=a[i]*10;
if(a[k]%cm==0)
{
g<<a[k];
return 0;
}
a[++k]=a[i]*10+1;
if(a[k]%cm==0)
{
g<<a[k];
return 0;
}
}
return 0;
}
