39902023-03-07 18:45:22horvathabelA sárkány feladványa (50)cpp17Wrong answer 47/503ms3760 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int cnt(int n){
	ll cnt=0; 
	while (n!=0){
		n/=10;
		cnt++;
	}
	return cnt;
}
void solve(){
	ll a,b,c;
	cin>>a>>b>>c;
	ll z=a;
	ll keres=b;
	while (z!=keres){
		if (z>keres) z-=keres;
		else keres-=z; 
	}
	ll lnt=(a*b)/z;
	ll db=cnt(lnt);
	if (db>c) cout<<-1<<endl;
	else{
		string ans=to_string(lnt);
		for (int i=db;i<c;i++){
			ans+='0';
		}
		cout<<ans<<endl; 
	}
}
int main() {
	for (int i=0; i<3;i++) solve();
}
SubtaskSumTestVerdictTimeMemory
base47/50
1Accepted0/03ms1808 KiB
2Accepted0/03ms2004 KiB
3Accepted3/33ms2216 KiB
4Accepted3/33ms2360 KiB
5Accepted3/32ms2584 KiB
6Accepted3/33ms2712 KiB
7Accepted3/32ms2792 KiB
8Accepted3/33ms3308 KiB
9Wrong answer0/33ms3152 KiB
10Accepted3/32ms3132 KiB
11Accepted3/33ms3324 KiB
12Accepted3/33ms3536 KiB
13Accepted4/42ms3652 KiB
14Accepted4/42ms3656 KiB
15Accepted4/43ms3652 KiB
16Accepted4/42ms3656 KiB
17Accepted4/43ms3760 KiB