230802026-01-16 11:43:57zoA sárkány feladványa (50)cpp17Elfogadva 50/501ms508 KiB
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    long long a,b,c,d,e,f,g,h,  i=1;
    long long t;
    long long q,w,v,lnko, lkkt;
    long long p=1;






    cin>>a>>b>>c;
    cin>>f>>g>>h;
    cin>>q>>w>>v;
    d=a;
    e=b;
    while (a!=b)
    {
        if (a>b)
        {
            a=a-b;
        }
        else
        {
            b=b-a;
        }
    }
    lnko=a;
    lkkt=((e*d)/lnko);

    t=lkkt;
    while (t/10>0)
    {
        p=p+1;
        t=t/10;
    }
    if (p>c)
    {
        lkkt=-1;
    }
    cout<<lkkt;
    if (p<c)
    {
        for (i=1; i<=c-p; i++)
        {
            cout << "0";
        }
    }
    cout << endl;





    d=f;
    e=g;
    p=1;
    i=1;
    while (f!=g)
    {
        if (f>g)
        {
            f=f-g;
        }
        else
        {
            g=g-f;
        }
    }
    lnko=f;
    lkkt=((e*d)/lnko);
    t=lkkt;
    while (t/10>0)
    {
        p=p+1;
        t=t/10;
    }
    if (p>h)
    {
        lkkt=-1;
    }
    cout<<lkkt;
    if (p<h)
    {
        for (i=1; i<=h-p; i++)
        {
            cout << "0";
        }
    }
    cout << endl;

    d=q;
    e=w;
    p=1;
    i=1;
    while (q!=w)
    {
        if (q>w)
        {
            q=q-w;
        }
        else
        {
            w=w-q;
        }
    }
    lnko=q;
    lkkt=((e*d)/lnko);
    t=lkkt;
    while (t/10>0)
    {
        p=p+1;
        t=t/10;
    }
    if (p>v)
    {
        lkkt=-1;
    }
    cout<<lkkt;
    if (p<v)
    {
        for (i=1; i<=v-p; i++)
        {
            cout << "0";
        }
    }
    cout << endl;





    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/01ms316 KiB
2Elfogadva0/01ms508 KiB
3Elfogadva3/31ms316 KiB
4Elfogadva3/31ms316 KiB
5Elfogadva3/31ms324 KiB
6Elfogadva3/31ms316 KiB
7Elfogadva3/31ms508 KiB
8Elfogadva3/31ms316 KiB
9Elfogadva3/31ms316 KiB
10Elfogadva3/31ms356 KiB
11Elfogadva3/31ms332 KiB
12Elfogadva3/31ms316 KiB
13Elfogadva4/41ms316 KiB
14Elfogadva4/41ms316 KiB
15Elfogadva4/41ms316 KiB
16Elfogadva4/41ms332 KiB
17Elfogadva4/41ms316 KiB