92832024-02-19 18:53:41AblablablaA sárkány feladványa (50)cpp17Wrong answer 22/503ms3980 KiB
#include <iostream>

using namespace std;

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

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

        int lnko = gcd(a, b);

        int lkkt = a * b / lnko;

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

        if(szam > n){
            cout << "-1\n";
        } else{
            cout << lkkt;
            for(int i = szam + 1; i <= n; i++){
                cout << "0";
            }
            cout << "\n";
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base22/50
1Accepted0/03ms2152 KiB
2Wrong answer0/03ms2188 KiB
3Accepted3/33ms2396 KiB
4Accepted3/33ms2536 KiB
5Accepted3/32ms2580 KiB
6Accepted3/33ms2704 KiB
7Accepted3/33ms2820 KiB
8Wrong answer0/33ms3064 KiB
9Wrong answer0/33ms3084 KiB
10Wrong answer0/33ms3352 KiB
11Wrong answer0/33ms3508 KiB
12Accepted3/33ms3564 KiB
13Wrong answer0/43ms3836 KiB
14Accepted4/43ms3836 KiB
15Wrong answer0/43ms3856 KiB
16Wrong answer0/43ms3848 KiB
17Wrong answer0/43ms3980 KiB