44502023-03-28 10:43:53uBORKAA sárkány feladványa (50)cpp17Wrong answer 0/503ms4188 KiB
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int a,b,c,szam,N;
    int hossz = 1;
    int szam2;
    int ae, be;

    int q[3][3] = {0};
    cin>> q[0][0] >> q[0][1] >> q[0][2] >> q[1][0] >> q[1][1] >> q[1][2] >> q[2][0] >> q[2][1] >> q[2][2];
    for(int l = 0; l<=2; l++)
    {
    ae=q[l][0];
    be=q[l][1];
    N = q[l][2];
    //cout<<ae<<" "<<be<<" "<<N<<endl;
    a=ae;
    b=be;

    if(b>a)
    {
       c=a;
       a=b;
       b=c;
    }
    while(a%b!=0)
    {
        c=a-b*(a/b);
        a=b;
        b=c;
    }
    szam=(ae*be)/b;
    szam2=szam;
    while(szam>=10)
    {
        hossz++;
        szam/=10;
    }
    if(hossz>N)
    {
        cout<<-1;
    }
    else
    {
        cout<<szam2;
        for(int i = (N-hossz); i>0; i--)
        {
            cout<<0;
        }
    }
    cout<<endl;
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1876 KiB
2Wrong answer0/03ms2120 KiB
3Wrong answer0/32ms2332 KiB
4Wrong answer0/33ms2540 KiB
5Wrong answer0/33ms2756 KiB
6Wrong answer0/33ms2876 KiB
7Wrong answer0/33ms2964 KiB
8Wrong answer0/33ms3024 KiB
9Wrong answer0/33ms3248 KiB
10Wrong answer0/33ms3364 KiB
11Wrong answer0/33ms3332 KiB
12Wrong answer0/33ms3460 KiB
13Wrong answer0/43ms3548 KiB
14Wrong answer0/43ms3652 KiB
15Wrong answer0/43ms4044 KiB
16Wrong answer0/43ms3984 KiB
17Wrong answer0/43ms4188 KiB