Cod sursa(job #290753)

Utilizator bog29Antohi Bogdan bog29 Data 28 martie 2009 17:17:28
Problema Multiplu Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include<fstream.h>
ifstream in("multiplu.in");
ofstream out("multiplu.out");
int a,b;
int estebun(long long int x)
{	while(x>0)
	{	if((x%10!=0)&&(x%10!=1))return 0;
		x=x/10;
	}
	return 1;
}	
void cauta()
{	long long int x=0;
	while(1)
	{	x++;
		if((x%a==0)&&(x%b==0))
			if(estebun(x))
			{	out<<x;
				break;
			}	
	}
}	
int main()
{	in>>a>>b;
	in.close();
	cauta();
	out.close();
	return 0;
}