47382023-03-31 10:31:33AGergoA sárkány feladványa (50)cpp17Wrong answer 22/503ms4000 KiB
#include <bits/stdc++.h>

using namespace std;

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

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int szam1, szam2, len, curlen;
    long num;

    for(int i = 0; i < 3; i++)
    {
        cin >> szam1 >> szam2 >> len;

        num = szam1*szam2/lnko(szam1,szam2);
        curlen = log10(num)+1;

        if(curlen > len)
        {
            if(i < 2)
            {
                cout << "-1\n";
            }
            else
            {
                cout << "-1";
            }
        }
        else
        {
            cout << num;
            for(int i = 0; i< len-curlen;i++)
            {
                cout << "0";
            }
            if(i != 2)
            {
                cout << "\n";
            }
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base22/50
1Accepted0/03ms1912 KiB
2Wrong answer0/03ms2136 KiB
3Accepted3/33ms2488 KiB
4Accepted3/33ms2616 KiB
5Accepted3/33ms2684 KiB
6Accepted3/33ms2852 KiB
7Accepted3/33ms3076 KiB
8Wrong answer0/33ms3096 KiB
9Wrong answer0/33ms3224 KiB
10Wrong answer0/33ms3596 KiB
11Wrong answer0/33ms3632 KiB
12Accepted3/33ms3836 KiB
13Wrong answer0/42ms3888 KiB
14Accepted4/42ms3896 KiB
15Wrong answer0/43ms3908 KiB
16Wrong answer0/43ms3904 KiB
17Wrong answer0/43ms4000 KiB