Task: | Kyselyt |
Sender: | SeveriK |
Submission time: | 2017-10-04 03:24:38 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.20 s | 1 | details |
#2 | WRONG ANSWER | 0.04 s | 2 | details |
#3 | WRONG ANSWER | 0.05 s | 3 | details |
Code
#include <iostream> #include <string> #include <vector> #include <math.h> using namespace std; int main() { unsigned int q = 0; cin >> q; for (unsigned int i = 0; i < q; i++) { unsigned long long int k = 0; cin >> k; unsigned int num = k; unsigned long long int n = 0; while (num > 0) { num = num / 10; n++; } unsigned long long int nums = 0; if (n > 1) { for (unsigned long long int o = 1; o < n; o++) { if (nums + o * 9 * pow(10, o - 1) < k) { nums += o * 9 * pow(10, o - 1); } else { break; } } } unsigned long long int output = (k - nums) / n; vector<unsigned int> digits; unsigned long long int lK = output; while (lK > 0) { digits.push_back(lK % 10); lK /= 10; } unsigned int mod = ((k - nums) % n) + 1; if (mod > 0 && mod <= digits.size()) { output = digits[digits.size() - mod]; } else { output = digits[digits.size() - 1]; } cout << output << "\n"; } int a; cin >> a; return 0; }
Test details
Test 1
Group: 1
Verdict: RUNTIME ERROR
input |
---|
1000 582 214 723 273 ... |
correct output |
---|
0 1 7 7 6 ... |
user output |
---|
1 8 1 2 9 ... Truncated |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 615664 916441 627600 279508 ... |
correct output |
---|
1 2 3 2 2 ... |
user output |
---|
1 8 1 0 6 ... Truncated |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000 672274832941907421 260504693279721732 646999966092970935 100853063389774434 ... |
correct output |
---|
7 2 2 0 9 ... |
user output |
---|
0 5 9 3 6 ... Truncated |