10212022-02-24 21:33:14Szin AttilaA sárkány feladványa (50)cpp14Accepted 50/502ms1992 KiB
#include <bits/stdc++.h>
using namespace std;
#define InTheNameOfGod ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
using ll = long long;

const ll maxN = 2e5 + 5;
const ll MOD = 1e9 + 7;

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

ll cnt(ll x) {
    ll ret = 0;
    while (x > 0) {
        ret++;
        x /= 10;
    }
    return ret;
}


int main() {
   InTheNameOfGod;

    ll t = 3;
    //cin >> t;
    while(t--)
    {
        ll a,b,n;
        cin >> a >> b >> n;

        ll temp = lca(a, b);
        ll temp2 = cnt(temp);
        if(temp2 > n) cout << "-1\n";
        else {
            cout << temp;
            for(ll i = 0; i < n-temp2; i++) cout << '0';
            cout << "\n";
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1884 KiB
2Accepted0/01ms1868 KiB
3Accepted3/31ms1928 KiB
4Accepted3/31ms1940 KiB
5Accepted3/31ms1936 KiB
6Accepted3/31ms1940 KiB
7Accepted3/31ms1948 KiB
8Accepted3/31ms1952 KiB
9Accepted3/31ms1952 KiB
10Accepted3/31ms1960 KiB
11Accepted3/31ms1964 KiB
12Accepted3/31ms1968 KiB
13Accepted4/41ms1968 KiB
14Accepted4/41ms1972 KiB
15Accepted4/41ms1984 KiB
16Accepted4/41ms1988 KiB
17Accepted4/42ms1992 KiB