Cod sursa(job #3236713)

Utilizator RaresStanStan Rares RaresStan Data 30 iunie 2024 16:47:44
Problema Multiplu Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ifstream cin("multiplu.in");
    ofstream cout("multiplu.out");
    long long a, b;
    cin >> a >> b;
    long long cmmmc = (a * b) / (__gcd(a , b));
    for (int i = 1; i <= (1 << 25) - 1; i++)
    {
        int x = 0;
        int j = i, p = 1;
        while(j)
        {
            x += p * (j % 2);
            p *= 10;
            j /= 2;
        }
        if(x % cmmmc == 0)
        {
            cout << x;
            break;
        }
    }
    return 0;
}