Task: | Kyselyt |
Sender: | mika |
Submission time: | 2017-10-04 22:21:53 +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.04 s | 1 | details |
#2 | WRONG ANSWER | 0.05 s | 2 | details |
#3 | WRONG ANSWER | 0.04 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:16:7: warning: unused variable '_n' [-Wunused-variable] int _n = n; ^
Code
#include <iostream>#include <string>#include <math.h>using namespace std;int main() {int c;cin >> c;int k = 0;while (k < c) {int n;cin >> n;k++;int _n = n;if (n < 10) {cout << n << endl;continue;}int nrot = 1;int ysi = 9;while (n - ysi * nrot > 0) {n -= nrot * ysi;ysi = ysi * 10;nrot++;}int mod = n % nrot;if (mod == 0)mod = nrot;int luku = pow(10, nrot - 1);if (mod == nrot)luku += n / nrot - 1;elseluku += n / nrot;//cout << "n: " << _n << " luku: " << luku << " mod: " << mod << endl;string lukustr = to_string(luku);if (lukustr[mod])cout << lukustr[mod] << endl;elsecout << luku % 10 << endl;}return 0;}/*1101001000100001-9 1nro 9lukua 9*1 =910-99 2nro 90lukua 90*2 =180100-999 3nro 900lukua 900*3 =27001000-9999 4nro 9000lukua 9000*4 =36000n=50 30 0*/
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 5 1 3 7 ... Truncated |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000 672274832941907421 260504693279721732 646999966092970935 100853063389774434 ... |
correct output |
---|
7 2 2 0 9 ... |
user output |
---|
7 -4 7 5 9 ... Truncated |