Cod sursa(job #2263958)

Utilizator BungerNadejde George Bunger Data 19 octombrie 2018 17:06:14
Problema Multiplu Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <bits/stdc++.h>

using namespace std;
ifstream fin  ("multiplu.in");
ofstream fout ("multiplu.out");
int a,b;
long long nr,m;


void baza(int x)
{
    int r, p=1;
    nr=0;
    while(x!=0)
    {
        r=x%2;
        x=x/2;
        nr=nr+r*p;
        p=p*10;
    }
}
void verif()
{
    bool ok=0;
    long long i=1;
    m=1;
    while(!ok)
    {
        baza(m);
        if(nr%a==0 && nr%b==0) ok=true;
        m++;
    }

}
int main()
{
    fin>>a>>b;
    verif();
    fout<<nr;
    return 0;
}