10202022-02-24 21:32:26Szin AttilaA sárkány feladványa (50)cpp14Wrong answer 22/502ms1988 KiB
#include <bits/stdc++.h>
using namespace std;
#define InTheNameOfGod ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
using ll = long long;

const int maxN = 2e5 + 5;
const int MOD = 1e9 + 7;

int lca(int a, int b) {
    return (a*b) / __gcd(a, b);
}

int cnt(int x) {
    int ret = 0;
    while (x > 0) {
        ret++;
        x /= 10;
    }
    return ret;
}


int main() {
   InTheNameOfGod;

    int t = 3;
    //cin >> t;
    while(t--)
    {
        int a,b,n;
        cin >> a >> b >> n;

        int temp = lca(a, b);
        int temp2 = cnt(temp);
        if(temp2 > n) cout << "-1\n";
        else {
            cout << temp;
            for(int i = 0; i < n-temp2; i++) cout << '0';
            cout << "\n";
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base22/50
1Accepted0/02ms1876 KiB
2Wrong answer0/01ms1868 KiB
3Accepted3/31ms1928 KiB
4Accepted3/31ms1936 KiB
5Accepted3/31ms1940 KiB
6Accepted3/31ms1944 KiB
7Accepted3/31ms1944 KiB
8Wrong answer0/31ms1972 KiB
9Wrong answer0/31ms1976 KiB
10Wrong answer0/31ms1956 KiB
11Wrong answer0/31ms1964 KiB
12Accepted3/31ms1964 KiB
13Wrong answer0/41ms1968 KiB
14Accepted4/41ms1972 KiB
15Wrong answer0/41ms1976 KiB
16Wrong answer0/41ms1980 KiB
17Wrong answer0/41ms1988 KiB