146792025-01-27 13:44:33DhaneHaneA sárkány feladványa (50)cpp17Elfogadva 50/501ms508 KiB
// sarkany.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

long long a, b, h;
using namespace std;
long long lnko(long long a, long long b) {
	long long r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

long long lkkt(long long a, long long b) {
	return a * b / lnko(a, b);
}
void sarkany() {
	cin >> a >> b >> h;
	a = lkkt(a, b);
	b = a;
	int i = 0;
	while (a != 0) {
		++i;
		a /= 10;
	}
	if (i > h) cout << -1;
	else {
		cout << b;
		while (i < h) {
			cout << 0;
			++i;
		}
	}
	cout << "\n";
}

int main() {
	for (int i = 1; i <= 3; ++i) {
		sarkany();
	}
}


// 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
base50/50
1Elfogadva0/01ms316 KiB
2Elfogadva0/01ms508 KiB
3Elfogadva3/31ms316 KiB
4Elfogadva3/31ms316 KiB
5Elfogadva3/31ms316 KiB
6Elfogadva3/31ms376 KiB
7Elfogadva3/31ms316 KiB
8Elfogadva3/31ms316 KiB
9Elfogadva3/31ms316 KiB
10Elfogadva3/31ms316 KiB
11Elfogadva3/31ms388 KiB
12Elfogadva3/31ms316 KiB
13Elfogadva4/41ms316 KiB
14Elfogadva4/41ms316 KiB
15Elfogadva4/41ms316 KiB
16Elfogadva4/41ms316 KiB
17Elfogadva4/41ms316 KiB