Cod sursa(job #258228)
| Utilizator | Data | 14 februarie 2009 21:21:05 | |
|---|---|---|---|
| Problema | Multiplu | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<stdio.h>
long long int a,b,alfa;
long int check(long long int x)
{
long long int aux;
int c,ok=1;
aux=x;
while(aux)
{
c=aux%10;
if(c!=0&&c!=1) {ok=0;break;}
aux/=10;
}
if(ok) return 1;
else return 0;
}
int main()
{
FILE*in=fopen("multiplu.in","r");
FILE*out=fopen("multiplu.out","w");
fscanf(in,"%lld %lld",&a,&b);
while(1)
{
alfa+=a*b;
if(check(alfa)) {fprintf(out,"%lld",alfa);break;}
}
fcloseall();
return 0;
}
