Task: | Kyselyt |
Sender: | Olli |
Submission time: | 2017-10-03 15:02:40 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.05 s | 1 | details |
#2 | WRONG ANSWER | 0.05 s | 2 | details |
#3 | WRONG ANSWER | 0.04 s | 3 | details |
Code
#include <iostream> using namespace std; typedef long long ll; ll power(ll a, ll b) { if(b == 0) { return 1; } if(b%2 == 0) { ll c = power(a, b/2); c = c*c; return c; } ll c = power(a,b - 1); return a * c; } int main() { int q; cin >> q; for(int a = 1; a <= q; a++) { ll k; cin >> k; ll digits = 1; ll amount = 9; ll total = 9; while(total < k) { digits++; amount *= 10; total += digits*amount; } total -= digits*amount; ll rem = (k-total)%digits; ll whole = (k-rem - total)/digits; whole = whole + power(10, digits - 1) - 1; int digitTable[100]; int index = 0; while(whole > 0) { int digit = whole%10; digitTable[index] = digit; index++; whole = whole/10; } cout << digitTable[rem] << "\n"; } }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
1000 582 214 723 273 ... |
correct output |
---|
0 1 7 7 6 ... |
user output |
---|
0 0 7 7 6 ... Truncated |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 615664 916441 627600 279508 ... |
correct output |
---|
1 2 3 2 2 ... |
user output |
---|
2 7 3 5 4 ... Truncated |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000 672274832941907421 260504693279721732 646999966092970935 100853063389774434 ... |
correct output |
---|
7 2 2 0 9 ... |
user output |
---|
7 5 1 0 9 ... Truncated |