Task: | Kyselyt |
Sender: | Katajisto |
Submission time: | 2017-10-06 20:19:50 +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.05 s | 1 | details |
#2 | ACCEPTED | 0.06 s | 2 | details |
#3 | WRONG ANSWER | 0.05 s | 3 | details |
Compiler report
input/code.cpp: In function 'int calc(uint64_t)': input/code.cpp:13:15: warning: unused variable 'tens' [-Wunused-variable] unsigned int tens; ^
Code
#include <stdint.h> #include <iostream> #include <vector> #include <cstdlib> #include <cmath> using namespace std; int calc(uint64_t i) { uint64_t numerot = 1U; uint64_t arvot = 1U; uint64_t raja = 9U; unsigned int tens; i--; while (i / raja >= numerot) { const uint64_t vanha_raja = raja; i -= numerot * raja; numerot++; arvot *= 10U; raja *= 10U; if (raja <= vanha_raja) break; } arvot += i / numerot; arvot /= pow(10,(numerot - 1) - (i % numerot)); return arvot % 10U; } int main() { vector<long long> queryvector = {}; long long int query; cin >> query; for (long int i = 0; i < query; i++) { long long int q; cin >> q; queryvector.push_back(q); } for (long long kysely : queryvector) { cout << calc(kysely) << endl; } }
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 |
---|
7 2 2 0 9 ... Truncated |