146472025-01-25 14:03:28zsombA sárkány feladványa (50)cpp17Wrong answer 0/50300ms6968 KiB
// Source: https://usaco.guide/general/io

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

int lca(int a, int b){
    if(a%b==0){
        return b;
    } else {
        return lca(b, a%b);
    }
}

int main() {
    for(int t = 0; t < 3; t++){
        int a, b, k;
        cin >> a>>b>>k;
        int u = a*b / lca(a,b);
        
        if(int(u / 10) > k){
            cout << -1 << endl;
            
        }else{
            cout << u;
            for(int i=0; i < k-int(u/10)-1; i++){
                cout << "0";
            }
            cout << endl;
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms508 KiB
2Wrong answer0/03ms508 KiB
3Wrong answer0/31ms316 KiB
4Wrong answer0/31ms316 KiB
5Wrong answer0/31ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/31ms500 KiB
8Time limit exceeded0/3298ms6752 KiB
9Time limit exceeded0/3287ms6708 KiB
10Wrong answer0/316ms564 KiB
11Wrong answer0/313ms748 KiB
12Wrong answer0/31ms316 KiB
13Time limit exceeded0/4300ms6968 KiB
14Wrong answer0/41ms316 KiB
15Wrong answer0/41ms316 KiB
16Wrong answer0/41ms356 KiB
17Time limit exceeded0/4282ms6452 KiB