Pagini recente » Diferente pentru downloads intre reviziile 69 si 70 | Diferente pentru downloads intre reviziile 325 si 51 | Diferente pentru downloads intre reviziile 108 si 107 | Diferente pentru downloads intre reviziile 198 si 197 | Cod sursa (job #2784421)
#include <bits/stdc++.h>
using namespace std;
ifstream f("multiplu.in");
ofstream g("multiplu.out");
int a, b, m;
void bfs(){
queue<long long> q;
q.push(1LL);
while(true == true){
long long cval = q.front();
if(cval % m == 0){
g << cval;
break;
}
q.push(cval * 10LL);
q.push(cval * 10LL + 1LL);
q.pop();
}
}
int main(){
f >> a >> b;
f.close();
m = (a * b) / __gcd(a, b);
bfs();
g.close();
}