150202025-02-11 11:02:25ercseferencA sárkány feladványa (50)cpp17Accepted 50/501ms508 KiB
#include <bits/stdc++.h>
using namespace std;
long long lkkt(long long a, long long b){
    int m=a,n=b,c=a%b;
    while(c!=0){m=n; n=c; c=m%n;}
    long long t=a*b/n;
    return t;}
int szj(long long n){
    int s=0;
    while(n!=0){s++; n=n/10;}
    return s;}
void fel(int a, int b, int n){
        int S=szj(lkkt(a,b));
        if(S>n)cout<<-1;
        else{cout<<lkkt(a,b);
            for(int i=0; i<n-S; i++){cout<<0;}}
        cout<<endl;}
int main()
{
    int a,b,n;
    for(int i=0; i<3; i++){
        cin>>a>>b>>n; fel(a,b,n);}
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted3/31ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms376 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted4/41ms316 KiB
14Accepted4/41ms508 KiB
15Accepted4/41ms508 KiB
16Accepted4/41ms316 KiB
17Accepted4/41ms316 KiB