Cod sursa(job #1418686)
| Utilizator | Data | 13 aprilie 2015 18:30:38 | |
|---|---|---|---|
| Problema | Multiplu | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.63 kb |
#include<fstream>
#define DIM 2000005
using namespace std;
ifstream fin("multiplu.in");
ofstream fout("multiplu.out");
int M,a,b,r,m,x,y,i,n;
int v[DIM];
char f[DIM];
int main(){
fin>>x>>y;
a=x;
b=y;
r=0;
while(b!=0){
r=a%b;
a=b;
b=r;
}
M=(x*y)/a;
v[1]=1;
n=1;
f[1]=1;
i=1;
while(v[i]%M!=0){
x=v[i]*10;
if(f[x%M]==0){
v[++n]=x;
f[x%M]=1;
}
x++;
if(f[x%M]==0){
v[++n]=x;
f[x%M]=1;
}
i++;
}
fout<<v[i];
return 0;
}
