2055 | 2022-12-16 00:12:22 | kovacs.peter.18f | A sárkány feladványa (50) | cpp11 | Forditási hiba |
#include <bits/stdc++.h>
using namespace std;
int digits(long long n) {
int result = 0;
while (n) {
n /= 10;
++result;
}
return result;
}
void task() {
long long A, B, N;
cin >> A >> B >> N;
long long m = lcm(A, B);
if (digits(m) > N) {
cout << "-1\n";
return;
}
cout << m;
for (int i = digits(m); i < N; i++) {
cout << 0;
}
cout << '\n';
}
int main() {
cin.sync_with_stdio(false);
cin.tie(nullptr);
for (int i = 0; i < 3; i++) {
task();
}
}
exit status 1
main.cpp: In function 'void task()':
main.cpp:17:19: error: 'lcm' was not declared in this scope
17 | long long m = lcm(A, B);
| ^~~
Exited with error status 1