Cod sursa(job #2711805)

Utilizator DariusGhercaDarius Gherca DariusGherca Data 24 februarie 2021 18:41:18
Problema Multiplu Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <bits/stdc++.h>

using namespace std;
ifstream f("multiplu.in");
ofstream g("multiplu.out");
int main()
{
    int x,y;
    f>>x>>y;
    x=x*y/__gcd(x,y);
    queue <int> q;
    q.push(1);
    while(!q.empty())
    {
        int t=q.front();
        q.pop();
        if(!(t%x))
        {
            g<<t;
            return 0;
        }
        t*=10;
        q.push(t);
        q.push(t+1);
    }
    return 0;
}