1342021-01-26 16:47:04kidesoA sárkány feladványa (50)cpp11Accepted 50/502ms1964 KiB
#include <iostream>
#include <cmath>

#define ll long long

using namespace std;

ll A, B, N, i, l, k, p;

ll lnko(ll a, ll b)
{
    ll r;
    r = a % b;
    while (r)
    {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

int main()
{
    k = 3;
    while (k)
    {
        --k;
        cin >> A >> B >> N;

        l = lnko(A, B);
        l = (A * B) / l;


        p = log10(l) + 1;
        if (p > N) cout << -1;
        else
        {
            cout << l;
            for (i = p + 1; i <= N; ++i)
                cout << 0;
        }

        cout << '\n';
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1804 KiB
2Accepted0/01ms1848 KiB
3Accepted3/31ms1904 KiB
4Accepted3/31ms1908 KiB
5Accepted3/31ms1920 KiB
6Accepted3/31ms1920 KiB
7Accepted3/31ms1928 KiB
8Accepted3/31ms1924 KiB
9Accepted3/31ms1928 KiB
10Accepted3/31ms1936 KiB
11Accepted3/31ms1940 KiB
12Accepted3/31ms1940 KiB
13Accepted4/42ms1948 KiB
14Accepted4/41ms1952 KiB
15Accepted4/41ms1948 KiB
16Accepted4/41ms1952 KiB
17Accepted4/41ms1964 KiB