16132022-11-29 11:40:54kicsiboglarA sárkány feladványa (50)cpp11Accepted 50/503ms3652 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long 

using namespace std;

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

ll n,m,i,j,a,b,c;

ll lnko (ll a, ll b)
{
    ll r=1;
    if (a==0||b==0) 
    {
        ll m=max(a,b);
        m=max(m,1LL);
        return m;
    }
    r=a%b;
    while (r!=0)
    {
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

ll lkkt (ll a, ll b)
{
    return a*b/lnko(a,b);
}

ll szamj (ll a)
{
    ll db=1;
    while (a>9)
    {
        db++;
        a=a/10;
    }
    return db;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    for (i=1;i<=3;++i)
    {
        cin>>a>>b>>n;
        m=lkkt(a,b);
        j=szamj(m);
        if (j>n) cout<<"-1\n";
        else
        {
            cout<<m;
            n-=j;
            while (n) 
            {
                n--;
                cout<<"0";
            }
            cout<<"\n"; 
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1764 KiB
2Accepted0/02ms1992 KiB
3Accepted3/32ms2152 KiB
4Accepted3/32ms2364 KiB
5Accepted3/32ms2440 KiB
6Accepted3/32ms2568 KiB
7Accepted3/32ms2772 KiB
8Accepted3/32ms2844 KiB
9Accepted3/32ms2844 KiB
10Accepted3/32ms2948 KiB
11Accepted3/32ms3024 KiB
12Accepted3/32ms3524 KiB
13Accepted4/42ms3492 KiB
14Accepted4/42ms3596 KiB
15Accepted4/42ms3652 KiB
16Accepted4/42ms3524 KiB
17Accepted4/42ms3584 KiB