210762026-01-12 11:06:58badamA sárkány feladványa (50)cpp17Time limit exceeded 0/50300ms4916 KiB
#include <iostream>
#include <numeric>
#include <cmath>
#include <algorithm>
using namespace std;
long long int gcd(long int a, long int b) {
    if(b == 0)return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return (a / gcd(a, b)) * b;
}
int cica(long long a, long long b, long long n)
{
    long long x=lcm(a,b);
    long long t=x, p=0;
    while(t)
    {
        p++;
        t=t/10;
    }
    if(p>=n)
    {
        cout << -1;
    }
    else
    {
        cout << x;
        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;
    cica(a,b,c);
    cout << endl;
    cica(d,e,f);
    cout << endl;
    cica(g,h,j);
    cout << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Time limit exceeded0/0289ms4660 KiB
2Time limit exceeded0/0289ms4660 KiB
3Runtime error0/32ms316 KiB
4Time limit exceeded0/3289ms4916 KiB
5Runtime error0/31ms316 KiB
6Runtime error0/32ms564 KiB
7Runtime error0/31ms508 KiB
8Runtime error0/31ms316 KiB
9Runtime error0/31ms316 KiB
10Time limit exceeded0/3287ms4660 KiB
11Time limit exceeded0/3300ms4844 KiB
12Time limit exceeded0/3284ms4660 KiB
13Runtime error0/41ms316 KiB
14Time limit exceeded0/4287ms4660 KiB
15Runtime error0/41ms500 KiB
16Time limit exceeded0/4298ms4896 KiB
17Time limit exceeded0/4300ms4916 KiB