Cod sursa(job #3160312)
Utilizator | Stoica Victor Toni07 | Data | 23 octombrie 2023 17:56:07 |
---|---|---|---|
Problema | Multiplu | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
ifstream fin ("multiplu.in");
ofstream fout ("multiplu.out");
int isbinary (unsigned long long m){
while (m>0){
if ((m%10!=0)&&(m%10!=1))
return 0;
m/=10;}
return 1;
}
int main()
{
int a, b, i;
fin >> a >> b;
int ca=a, cb=b;
while (ca&&cb){
if (ca>cb) ca-=cb;
else cb-=ca;}
int m=(a*b)/(cb+ca);
for (i=1;i<=INT_MAX;++i)
if (isbinary(i*m)) break;
fout << i*m;
return 0;
}