158082025-03-03 12:59:11zsombA sárkány feladványa (50)cpp17Accepted 50/501ms532 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

long long lnko(long long a, long long b)
{
    if (a % b == 0)
    {
        return b;
    }
    else
    {
        return lnko(b, a % b);
    }
}

int main()
{
    for (int t = 0; t < 3; t++)
    {
        long long a, b, k;
        cin >> a >> b >> k;
        long long u = a * b / lnko(a, b);

        //----------------------------------------\\ 

        if (int(log10(u)) >= k)
        {
            cout << -1 << endl;
        }
        else
        {
            int karakterszam = int(log10(u));
            cout << u;
            for (int i = 0; i < k - karakterszam - 1; i++)
            {
                cout << "0";
            }
            cout << endl;
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted3/31ms500 KiB
4Accepted3/31ms316 KiB
5Accepted3/31ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms500 KiB
13Accepted4/41ms532 KiB
14Accepted4/41ms316 KiB
15Accepted4/41ms316 KiB
16Accepted4/41ms316 KiB
17Accepted4/41ms316 KiB