91002024-02-13 22:26:30RRoliA sárkány feladványa (50)cpp17Accepted 50/503ms4032 KiB
#include <bits/stdc++.h>
using namespace std;

#define schlong_long long long

schlong_long lkkt(schlong_long a, schlong_long b) {
    schlong_long m = a % b, x = a, y = b;
    while(m != 0) {
        a = b;
        b = m;
        m = a % b;
    }
    return x * y / b;
}

schlong_long szjsz(schlong_long k) {
    schlong_long t = 0;
    while(k != 0) {
        k /= 10;
        t++;
    }
    return t;
}

int main()
{
    for(schlong_long i = 0; i < 3; i++) {
        schlong_long a, b, n;
        cin >> a >> b >> n;
        schlong_long p = lkkt(a, b);
        if(p > pow(10, n)-1) cout << -1;
        else {
            cout << p;
            for(schlong_long j = szjsz(p); j < n; j++) cout << 0;
        }
        cout << '\n';
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2068 KiB
3Accepted3/33ms2308 KiB
4Accepted3/33ms2528 KiB
5Accepted3/33ms2612 KiB
6Accepted3/33ms2736 KiB
7Accepted3/33ms2948 KiB
8Accepted3/33ms3036 KiB
9Accepted3/33ms3272 KiB
10Accepted3/33ms3216 KiB
11Accepted3/33ms3452 KiB
12Accepted3/33ms3668 KiB
13Accepted4/43ms3752 KiB
14Accepted4/43ms3640 KiB
15Accepted4/43ms3636 KiB
16Accepted4/43ms4032 KiB
17Accepted4/43ms3800 KiB