Cod sursa(job #1435904)

Utilizator OpportunityVlad Negura Opportunity Data 14 mai 2015 19:05:15
Problema Multiplu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <fstream>
using namespace std;

ifstream fi("multiplu.in");
ofstream fo("multiplu.out");

long long a,b,xa,xb;

int is01(long long x) {
	while (x) {
		if (x % 10 > 1) {
			return 0;
		}
		x /= 10;
	}

	return 1;
}


int main() {
	fi >> a >> b;


	while (xa*xb < 2000000) {
		xa += a;
		while (xa*xb < 2000000) {
			xb += b;
			if (is01(xa*xb)) {
				fo << xa*xb;
				return 0;
			}
		}
	}

	return 0;
}