166732025-05-08 13:36:13UVinceA sárkány feladványa (50)cpp17Accepted 50/501ms548 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

void main1() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    long long a,b,n;
    cin>>a>>b>>n;
    long long gcd = __gcd(a,b);
    gcd = a*b/gcd;
    if (to_string(gcd).size()>n){
        cout<<-1<<"\n";
        return;
    }
    cout<<gcd;
    for (int i=0;i<n-to_string(gcd).size();i++) cout<<0;
    cout<<"\n";
}
int main(){
    main1();
    main1();
    main1();
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms508 KiB
2Accepted0/01ms508 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted3/31ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms548 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms508 KiB
13Accepted4/41ms316 KiB
14Accepted4/41ms316 KiB
15Accepted4/41ms316 KiB
16Accepted4/41ms316 KiB
17Accepted4/41ms316 KiB