Cod sursa(job #2262753)

Utilizator PredaBossPreda Andrei PredaBoss Data 17 octombrie 2018 19:51:27
Problema Multiplu Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.33 kb
#include <bits/stdc++.h>

using namespace std;
ifstream fin("multiplu.in");
ofstream fout("multiplu.out");
long long a,b;
void bkk(int pos,int n)
{
    if(pos==18){if(n%a==0 && n%b==0 && n!=0)fout<<n ,exit(0); return;}
    n*=10;bkk(pos+1,n);bkk(pos+1,n+1);
}
int main()
{
    fin>>a>>b;
    bkk(0,0);
    return 0;
}