CSES - Datatähti 2018 alku - Results
Submission details
Task:Kyselyt
Sender:paavoee
Submission time:2017-10-07 23:37:26 +0300
Language:C++
Status:READY
Result:37
Feedback
groupverdictscore
#1ACCEPTED12
#2ACCEPTED25
#30
Test results
testverdicttimegroup
#1ACCEPTED0.06 s1details
#2ACCEPTED0.06 s2details
#30.07 s3details

Code

#include <iostream>
#include <vector>

using namespace std;

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

	unsigned short int q;
	vector<unsigned long long int> kt;
	cin >> q;
	for (int i = 0; i < q; i++) {
		unsigned long long int tmp;
		cin >> tmp;
		kt.push_back(tmp);
	}

	for (unsigned int i = 0; i < kt.size(); i++) {
		unsigned long long int k = kt[i];
		if (k < 10) {
			cout << k << endl;
			continue;
		}
		k -= 10;
		if (k < 180) {
//			int r = k / 20;
//			if (k % 2 == 1) cout << (k - 20*r - 1) / 2 << endl;
//			else cout << r + 1 << endl;
			int j = k % 2;
			if (j == 0) cout << k / 20 + 1 << endl;
			else /*if (j == 1)*/ cout << (k / 2) % 10 << endl;
			continue;
		}
		k -= 180;
		if (k < 2700) {
			int j = k % 3;
			if (j == 0) cout << k / 300 + 1 << endl;
			else if (j == 1) cout << (k / 30) % 10 << endl;
			else /*if (j == 2)*/ cout << (k / 3) % 10 << endl;
			continue;
		}
		k -= 2700;
		if (k < 36000) {
			int j = k % 4;
			if (j == 0) cout << k / 4000 + 1 << endl;
			else if (j == 1) cout << (k / 400) % 10 << endl;
			else if (j == 2) cout << (k / 40) % 10 << endl;
			else /*if (j == 3)*/ cout << (k / 4) % 10 << endl;
			continue;
		}
		k -= 36000;
		if (k < 450000) {
			int j = k % 5;
			if (j == 0) cout << k / 50000 + 1 << endl;
			else if (j == 1) cout << (k / 5000) % 10 << endl;
			else if (j == 2) cout << (k / 500) % 10 << endl;
			else if (j == 3) cout << (k / 50) % 10 << endl;
			else /*if (j == 4)*/ cout << (k / 5) % 10 << endl;
			continue;
		}
		k -= 450000;
		if (k < 5400000) {
			int j = k % 6;
			if (j == 0) cout << k / 600000 + 1 << endl;
			else if (j == 1) cout << (k / 60000) % 10 << endl;
			else if (j == 2) cout << (k / 6000) % 10 << endl;
			else if (j == 3) cout << (k / 600) % 10 << endl;
			else if (j == 4) cout << (k / 60) % 10 << endl;
			else /*if (j == 5)*/ cout << (k / 6) % 10 << endl;
			continue;
		}
	}

	return 0;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
1000
582
214
723
273
...

correct output
0
1
7
7
6
...

user output
0
1
7
7
6
...
Truncated

Test 2

Group: 2

Verdict: ACCEPTED

input
1000
615664
916441
627600
279508
...

correct output
1
2
3
2
2
...

user output
1
2
3
2
2
...
Truncated

Test 3

Group: 3

Verdict:

input
1000
672274832941907421
260504693279721732
646999966092970935
100853063389774434
...

correct output
7
2
2
0
9
...

user output
(empty)