88452024-02-01 16:36:08hackemonA sárkány feladványa (50)cpp17Accepted 50/503ms3868 KiB
#include <bits/stdc++.h>
using namespace std;

long long gcd(long long a, long long b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}


int main() {
    //freopen("be1.txt", "r", stdin);

    for(int i = 0;i < 3;i++ ) {
        long long a, b, c;
        cin >> a >> b >> c;
        long long f = lcm(a, b);
        int counter = 0; 
        long long t = f;
        while(t > 0) {
            t/=10;
            counter++;
        }
        if(counter > c) cout << -1;
        else {
            cout << f;
            for(int i = 0;i < c - counter;i++) {
                cout << 0;
            }
        }
        cout << endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms2064 KiB
2Accepted0/03ms2276 KiB
3Accepted3/33ms2404 KiB
4Accepted3/33ms2492 KiB
5Accepted3/33ms2632 KiB
6Accepted3/33ms2848 KiB
7Accepted3/33ms3012 KiB
8Accepted3/33ms2996 KiB
9Accepted3/33ms3000 KiB
10Accepted3/33ms3128 KiB
11Accepted3/33ms3348 KiB
12Accepted3/33ms3564 KiB
13Accepted4/43ms3612 KiB
14Accepted4/43ms3616 KiB
15Accepted4/43ms3616 KiB
16Accepted4/43ms3868 KiB
17Accepted4/43ms3836 KiB