8692022-01-21 21:03:28Valaki2A sárkány feladványa (50)cpp14Wrong answer 22/502ms2040 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;
}

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

void solve() {
    ll a, b, n;
    cin >> a >> b >> n;
    int c = lcm(a, b);
    int d = digit_cnt(c);
    if(d > n) {
        cout << "-1\n";
        return;
    }
    cout << c;
    for(int 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
base22/50
1Accepted0/02ms1968 KiB
2Wrong answer0/01ms1948 KiB
3Accepted3/31ms1984 KiB
4Accepted3/31ms1988 KiB
5Accepted3/32ms1996 KiB
6Accepted3/32ms1996 KiB
7Accepted3/32ms2004 KiB
8Wrong answer0/31ms2000 KiB
9Wrong answer0/31ms2008 KiB
10Wrong answer0/31ms2016 KiB
11Wrong answer0/31ms2016 KiB
12Accepted3/31ms2020 KiB
13Wrong answer0/41ms2020 KiB
14Accepted4/41ms2024 KiB
15Wrong answer0/41ms2028 KiB
16Wrong answer0/41ms2032 KiB
17Wrong answer0/41ms2040 KiB