Task: | Kyselyt |
Sender: | valokoodari |
Submission time: | 2017-10-06 08:44:55 +0300 |
Language: | C++ |
Status: | READY |
Result: | 37 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 12 |
#2 | ACCEPTED | 25 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.04 s | 1 | details |
#2 | ACCEPTED | 0.05 s | 2 | details |
#3 | WRONG ANSWER | 0.06 s | 3 | details |
Code
#include <bits/stdc++.h> using namespace std; long long int func1(int a) { long long int b = 10; for (int i = 1; i < a; i++) { b += 9 * pow(10, i) * (i + 1); } return b; } int main() { int q; cin >> q; long long int k[q]; for (int i = 0; i < q; i++) { cin >> k[i]; } for (int i = 0; i < q; i++) { int a = 1; if (k[i] < 10) { cout << k[i] << endl; } else { while (true) { if (k[i] < func1(a)) { long long int l = k[i] - func1(a-1); long long int m = l%a; string num = to_string(((l-m)/a) + pow(10, a-1)); cout << num[m] << endl; break; } a++; } } } }
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: WRONG ANSWER
input |
---|
1000 672274832941907421 260504693279721732 646999966092970935 100853063389774434 ... |
correct output |
---|
7 2 2 0 9 ... |
user output |
---|
4 2 7 0 8 ... Truncated |