41452023-03-15 14:50:20gittyA sárkány feladványa (50)cpp17Accepted 50/504ms3796 KiB
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    //ifstream cin("in.txt");
    ///initializing
    long long int a, b;
    long long int n;
    long long int s1, s;
    long long int temp;
    ///the program:
    for(int i=1; i<=3; i++)
    {
        s1=0;
        s=0;
        cin>>a>>b>>n;
    ///lkkt:
        if(b>a) swap(a,b);
        s1=a;
        while(s1%b!=0)
        {
        s1+=a;
        }
   // cout<<s1<<" ";
    ///sarkanyszam (felbontas)
    s=s1;
    temp = 0;
    while(s1!=0)
    {
        s1/=10;
        temp++;
    }
    //cout << temp<<" ";
    ///
    if(temp>n) cout<<-1<<"\n";
    else
    {
     n-=temp;
     cout<<s;
     for(int j = 1; j<=n; j++)
     {
           cout<<0;
     }
     cout<<endl;
    }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2068 KiB
3Accepted3/33ms2184 KiB
4Accepted3/33ms2264 KiB
5Accepted3/33ms2656 KiB
6Accepted3/33ms2728 KiB
7Accepted3/33ms2696 KiB
8Accepted3/34ms2828 KiB
9Accepted3/34ms2904 KiB
10Accepted3/33ms3032 KiB
11Accepted3/33ms3120 KiB
12Accepted3/34ms3120 KiB
13Accepted4/43ms3404 KiB
14Accepted4/43ms3408 KiB
15Accepted4/43ms3464 KiB
16Accepted4/44ms3712 KiB
17Accepted4/44ms3796 KiB