Pagini recente » Cod sursa (job #3268879) | Cod sursa (job #1644348) | Cod sursa (job #2040521) | Cod sursa (job #1258692) | Cod sursa (job #115061)
Cod sursa(job #115061)
#include <stdio.h>
#include <stdlib.h>
long long a,b;
long long m;
int x[100],printed;
void read(){
freopen("multiplu.in","r",stdin);
scanf("%lld%lld",&a,&b);
}
void afish(int nr){
m=0;
for(int i=1;i<=nr;i++)
m=m*10+x[i];
if(m%a==0 && m%b==0){
printf("%lld",m);
printed=1;
}
}
void back(int k,int nr){
int i;
for(i=0;i<=1;i++){
x[k]=i;
if(x[1]!=0){
if(k==nr)
afish(nr);
else
back(k+1,nr);
}
if(printed==1)
return;
}
}
int main(){
read();
freopen("multiplu.out","w",stdout);
for(int i=2;i<=30;i++)
if(printed!=1)
back(1,i);
fclose(stdout);
return 0;
}