20542022-12-16 00:11:43kovacs.peter.18fA sárkány feladványa (50)cpp11Forditási hiba
#include <iostream>
#include <numeric>
#include <string>

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();
    }
}
Forditási hiba
exit status 1
main.cpp: In function 'void task()':
main.cpp:19:19: error: 'lcm' was not declared in this scope
   19 |     long long m = lcm(A, B);
      |                   ^~~
Exited with error status 1