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