CSES - HIIT Open 2019 - Results
Submission details
Task:Alien Invasion II
Sender:bigint bugaa
Submission time:2019-05-25 11:04:48 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.02 sdetails
#20.02 sdetails
#30.04 sdetails

Code

#include <iostream>
using namespace std;
using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	ll n;
	cin >> n;

	int sum = 0;
	ll tmp = n;
	ll mult = 1;
	while(tmp > 0) {
		sum += (tmp % 10) % 3;
		tmp /= 10;
		mult *= 10;
	}
	sum %= 3;

	if (sum == 0) n += mult * 3;
	else if (sum == 1) n += mult * 2;
	else n += mult;

	cout << n << '\n';
	cout << n/3 << ' ' << 3 << '\n';
}

Test details

Test 1

Verdict: ACCEPTED

input
2368469234876449

correct output
22368469234876449
3 7456156411625483

user output
22368469234876449
7456156411625483 3

Test 2

Verdict:

input
292929292929292929292929292931

correct output
129292929292929292929292929293...

user output
-7670116110564327425
-2556705370188109141 3

Test 3

Verdict:

input
292929292929292929292929292979

correct output
129292929292929292929292929297...

user output
-7670116110564327425
-2556705370188109141 3