43132023-03-23 12:35:47gkataA sárkány feladványa (50)cpp17Accepted 50/503ms4100 KiB
#include <iostream>
#define ll long long

using namespace std;

//ifstream cin("s.in");
//ofstream cout("s.out");

ll a,b,n,i,k,l,r,sz,s,db,j;

int main()
{
    for(i=1;i<=3;++i)
    {
        db=0;
        cin>>a>>b>>n;
        k=a;
        l=b;

        r=a%b;
        while(r>0)
        {
            a=b;
            b=r;
            r=a%b;
        }
        sz=k*l/b;
        s=sz;
        while(s>0)
        {
            s/=10;
            ++db;
        }
        //cout<<sz<<" "<<db<<"\n";

        if(db<=n)
        {
            cout<<sz;
            for(j=0;j<n-db;++j) cout<<0;
        }
        else cout<<-1;
        cout<<"\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1748 KiB
2Accepted0/03ms1996 KiB
3Accepted3/32ms2204 KiB
4Accepted3/32ms2340 KiB
5Accepted3/33ms2552 KiB
6Accepted3/33ms2788 KiB
7Accepted3/33ms2976 KiB
8Accepted3/33ms3308 KiB
9Accepted3/33ms3476 KiB
10Accepted3/32ms3520 KiB
11Accepted3/32ms3636 KiB
12Accepted3/32ms3720 KiB
13Accepted4/43ms3756 KiB
14Accepted4/43ms3908 KiB
15Accepted4/43ms3912 KiB
16Accepted4/43ms3904 KiB
17Accepted4/43ms4100 KiB