146662025-01-27 09:28:03DhaneHaneA sárkány feladványa (50)cpp17Időlimit túllépés 15/50300ms536 KiB
// sarkany.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

using namespace std;
int szam(int a, int b, int h, unsigned long long kereset) {
    int db = 0; 
    unsigned long long k = kereset;
    while (k > 0) {
        k /= 10;
        ++db;
    }
    if (kereset % a == 0 && kereset % b == 0 && db == h) {
        return kereset;
    }
    else if (db > h) return -1;
    return szam(a, b, h, kereset + 1);
}

int main()
{
    int a1, b1, h1, a2, b2, h2, a3, b3, h3; 
    cin >> a1 >> b1 >> h1>>a2>>b2>>h2>>a3>>b3>>h3;
    unsigned long long kereset=max(a1,b1);
    cout<<szam(a1, b1, h1, kereset)<<"\n";
    kereset = max(a2, b2);
    cout<<szam(a2, b2, h2, kereset)<<"\n";
    kereset = max(a3, b3);
    cout<<szam(a3, b3, h3, kereset)<<"\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
RészfeladatÖsszpontTesztVerdiktIdőMemória
base15/50
1Időlimit túllépés0/0277ms316 KiB
2Időlimit túllépés0/0280ms316 KiB
3Elfogadva3/31ms316 KiB
4Elfogadva3/32ms316 KiB
5Elfogadva3/31ms316 KiB
6Elfogadva3/31ms316 KiB
7Elfogadva3/31ms316 KiB
8Időlimit túllépés0/3300ms316 KiB
9Időlimit túllépés0/3300ms316 KiB
10Időlimit túllépés0/3284ms316 KiB
11Időlimit túllépés0/3284ms508 KiB
12Időlimit túllépés0/3280ms316 KiB
13Időlimit túllépés0/4300ms316 KiB
14Időlimit túllépés0/4284ms316 KiB
15Időlimit túllépés0/4286ms536 KiB
16Időlimit túllépés0/4300ms316 KiB
17Időlimit túllépés0/4284ms316 KiB