90252024-02-12 11:24:36akososkaA sárkány feladványa (50)cpp17Accepted 50/503ms4220 KiB
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    struct felad{
        long long egy;
        long long mas;
        long long jegy;
    }a[4];
    for(int i=1;i<=3;i++){
        cin>>a[i].egy;
        cin>>a[i].mas;
        cin>>a[i].jegy;
    }
    for(int i=1;i<=3;i++){
        long long q=a[i].egy%a[i].mas,s1=a[i].egy,s2=a[i].mas;
        while(q!=0){
            s1=s2;
            s2=q;
            q=s1%s2;
        }
        q=a[i].egy/s2*a[i].mas;
        int k=0;
        long long q2=q;
        while(q2!=0){
            k++;
            q2=q2/10;
        }
        if(k>a[i].jegy)cout<<-1;
        else{
            cout<<q;
            for(int j=k;j<a[i].jegy;j++)cout<<0;
        }
        cout<<endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms2004 KiB
2Accepted0/03ms2100 KiB
3Accepted3/33ms2296 KiB
4Accepted3/33ms2384 KiB
5Accepted3/33ms2376 KiB
6Accepted3/33ms2628 KiB
7Accepted3/33ms2840 KiB
8Accepted3/33ms3056 KiB
9Accepted3/33ms3312 KiB
10Accepted3/32ms3304 KiB
11Accepted3/33ms3580 KiB
12Accepted3/33ms3532 KiB
13Accepted4/43ms3648 KiB
14Accepted4/43ms3756 KiB
15Accepted4/43ms3868 KiB
16Accepted4/43ms3972 KiB
17Accepted4/43ms4220 KiB