Cod sursa(job #2836408)
Utilizator | Data | 20 ianuarie 2022 12:34:46 | |
---|---|---|---|
Problema | Multiplu | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
#include <queue>
using namespace std;
int main()
{
ifstream fin("multiplu.in");
ofstream fout("multiplu.out");
std::queue<int> mq;
int a, b;
fin >> a >> b;
mq.push(1);
while(!mq.empty() && (mq.front()%a || mq.front()%b))
{
mq.push(mq.front()*10);
mq.push(mq.front()*10+1);
mq.pop();
}
fout << mq.front() << endl;
return 0;
}