Cod sursa(job #3157535)
| Utilizator | Data | 15 octombrie 2023 18:18:34 | |
|---|---|---|---|
| Problema | Multiplu | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("multiplu.in");
ofstream fout("multiplu.out");
long long a, b;
long long cmmdc(long long a, long long b) {
while (b != 0) {
long long r = a % b;
a = b;
b = r;
}
return a;
}
bool ok(long long x) {
while (x != 0) {
if (x % 10 > 1)
return false;
x /= 10;
}
return true;
}
int main() {
fin >> a >> b;
long long x = a * b / cmmdc(a, b);
long long i = 1;
while (!ok(x * i)) {
i++;
}
fout << (x * i);
return 0;
}
