86752024-01-25 07:08:40BenedekMartonA sárkány feladványa (50)cpp17Accepted 50/504ms3964 KiB
#include <iostream>

using namespace std;

int main()
{
    long long a, b, n, maxoszto, mab, lkt, szjh, k, lktm;
    for(int i=0; i<3; i++)
    {
        cin >> a >> b >> n;
        mab=min(a, b);
        for(int j=1; j<=mab; j++)
        {
            if(a%j==0 and b%j==0)
            {
                maxoszto=j;
            }
        }
        lkt=a/maxoszto*b;
        lktm=lkt;
        for(k=0; lktm>0; k++)
        {
            lktm=lktm/10;
        }
        if(k>n)
        {
            cout << "-1" << endl;
        }
        else
        {
            cout << lkt;
            for(int l=k+1; l<=n; l++)
            {
                cout << 0;
            }
            cout << endl;
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/04ms2120 KiB
3Accepted3/33ms2332 KiB
4Accepted3/33ms2576 KiB
5Accepted3/33ms2640 KiB
6Accepted3/33ms2744 KiB
7Accepted3/33ms2948 KiB
8Accepted3/34ms3036 KiB
9Accepted3/34ms3040 KiB
10Accepted3/34ms3168 KiB
11Accepted3/33ms3256 KiB
12Accepted3/34ms3224 KiB
13Accepted4/44ms3256 KiB
14Accepted4/43ms3456 KiB
15Accepted4/44ms3664 KiB
16Accepted4/44ms3876 KiB
17Accepted4/44ms3964 KiB