210642026-01-12 10:46:05badamA sárkány feladványa (50)cpp17Runtime error 0/50300ms4948 KiB
#include <iostream>
#include <numeric>
#include <cmath>
#include <algorithm>
using namespace std;
int cigany(long long a, long long b, long long n)
{
    long long x=lcm(a,b);
    long long y=pow(10,n-1);
    long long z=pow(10,n);
    if(n<=12)
    {
        if(floor(z/x)==floor(y/x))
        {
            cout << -1;
        }
        else cout << (floor(y/x)+1)*x;
    }
    else
    {
        cout << x;
        int t=x, p=0;
        while(t!=0)
        {
            p++;
            t=t/10;
        }
        for(int i=0; i<n-p; i++) cout << 0;
    }
}
int main()
{
    long long a,b,c;
    cin >> a >> b >> c;
    long long d, e,f;
    long long g, h, j;
    cin >> d >> e >> f;
    cin >> g >> h >> j;
    cigany(a,b,c);
    cout << endl;
     cigany(d,e,f);
     cout << endl;
     cigany(g,h,j);
     cout << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/01ms332 KiB
2Runtime error0/01ms604 KiB
3Runtime error0/31ms316 KiB
4Runtime error0/31ms316 KiB
5Runtime error0/31ms316 KiB
6Runtime error0/31ms316 KiB
7Runtime error0/31ms316 KiB
8Runtime error0/31ms316 KiB
9Runtime error0/31ms316 KiB
10Time limit exceeded0/3280ms4660 KiB
11Time limit exceeded0/3284ms4692 KiB
12Time limit exceeded0/3284ms4660 KiB
13Runtime error0/41ms316 KiB
14Time limit exceeded0/4286ms4660 KiB
15Runtime error0/41ms572 KiB
16Time limit exceeded0/4300ms4948 KiB
17Time limit exceeded0/4300ms4916 KiB