92842024-02-19 18:55:19AblablablaA sárkány feladványa (50)cpp17Accepted 50/503ms4108 KiB
#include <iostream>

using namespace std;

typedef long long ll;

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

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

        ll lnko = gcd(a, b);

        ll lkkt = a * b / lnko;

        ll szam = 0;
        ll mas = lkkt;
        while(mas > 0){
            szam++;
            mas /= 10;
        }

        if(szam > n){
            cout << "-1\n";
        } else{
            cout << lkkt;
            for(ll i = szam + 1; i <= n; i++){
                cout << "0";
            }
            cout << "\n";
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2116 KiB
3Accepted3/33ms2332 KiB
4Accepted3/33ms2576 KiB
5Accepted3/33ms2792 KiB
6Accepted3/33ms2828 KiB
7Accepted3/33ms3032 KiB
8Accepted3/33ms3188 KiB
9Accepted3/33ms3408 KiB
10Accepted3/33ms3404 KiB
11Accepted3/33ms3600 KiB
12Accepted3/33ms3672 KiB
13Accepted4/43ms3768 KiB
14Accepted4/43ms3880 KiB
15Accepted4/43ms4004 KiB
16Accepted4/43ms4000 KiB
17Accepted4/43ms4108 KiB