8702022-01-21 21:04:48Valaki2A sárkány feladványa (50)cpp14Accepted 50/502ms1988 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll digit_cnt(ll x) {
    ll result = 0;
    while(x) {
        result++;
        x /= 10;
    }
    return result;
}

ll lcm(ll a, ll b) {
    return a * b / __gcd(a, b);
}

void solve() {
    ll a, b, n;
    cin >> a >> b >> n;
    ll c = lcm(a, b);
    ll d = digit_cnt(c);
    if(d > n) {
        cout << "-1\n";
        return;
    }
    cout << c;
    for(ll i = 0; i < n - d; i++) {
        cout << "0";
    }
    cout << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    for(int test_index = 1; test_index <= 3; test_index++) {
        solve();
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1820 KiB
2Accepted0/01ms1872 KiB
3Accepted3/31ms1928 KiB
4Accepted3/31ms1936 KiB
5Accepted3/31ms1940 KiB
6Accepted3/31ms1944 KiB
7Accepted3/31ms1952 KiB
8Accepted3/31ms1952 KiB
9Accepted3/31ms1956 KiB
10Accepted3/31ms1972 KiB
11Accepted3/31ms1960 KiB
12Accepted3/31ms1976 KiB
13Accepted4/41ms1976 KiB
14Accepted4/41ms1972 KiB
15Accepted4/41ms1976 KiB
16Accepted4/41ms1984 KiB
17Accepted4/41ms1988 KiB