150942025-02-12 18:45:59horkaA sárkány feladványa (50)cpp17Accepted 50/501ms508 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=3;
    while(t--)
    {
        int a,b,n; cin>>a>>b>>n;
        int lcm=a/__gcd(a,b)*b;
        string s=to_string(lcm);
        int mer=s.size();
        if(mer>n)
        {
            cout<<"-1\n";
            continue;
        }
        cout<<lcm;
        for(int i=0; i<n-mer; i++)
            cout<<"0";
        cout<<"\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted3/31ms508 KiB
4Accepted3/31ms316 KiB
5Accepted3/31ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms508 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted4/41ms316 KiB
14Accepted4/41ms508 KiB
15Accepted4/41ms316 KiB
16Accepted4/41ms316 KiB
17Accepted4/41ms316 KiB