93942024-02-21 12:14:03Vkrisztian01A sárkány feladványa (50)cpp17Accepted 50/503ms3608 KiB
#include <iostream>
#include<algorithm>

using namespace std;

long long int gcd(long long int a,long long int b)
{
    if(a<b) swap(a,b);
    if(b) return gcd(a%b,b);
    return a;
}

long long int lcm(long long int a,long long int b)
{
    return a*b/gcd(a,b);
}

int szamjegy(long long int x)
{
    int db=0;
    while(x)
    {
        ++db;
        x/=10;
    }
    return db;
}

int main()
{
    int q=3;
    long long int a,b,c,t,k;
    while(q--)
    {
        cin>>a>>b>>t;
        c=lcm(a,b);
        k=szamjegy(c);
        if(k>t)
        {
          cout<<-1<<endl;
          continue;
        }
        cout<<c;
        t-=k;
        while(t--)cout<<0;
        cout<<endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2116 KiB
3Accepted3/33ms2328 KiB
4Accepted3/33ms2488 KiB
5Accepted3/33ms2604 KiB
6Accepted3/32ms2672 KiB
7Accepted3/33ms2800 KiB
8Accepted3/33ms3016 KiB
9Accepted3/33ms3248 KiB
10Accepted3/33ms3360 KiB
11Accepted3/33ms3380 KiB
12Accepted3/33ms3520 KiB
13Accepted4/43ms3604 KiB
14Accepted4/43ms3608 KiB
15Accepted4/43ms3604 KiB
16Accepted4/43ms3608 KiB
17Accepted4/43ms3608 KiB