Task: | Kyselyt |
Sender: | Katajisto |
Submission time: | 2017-10-06 20:28:59 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 1 | details |
#2 | TIME LIMIT EXCEEDED | -- | 2 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int calc(uint64_t)': input/code.cpp:11:15: warning: unused variable 'tens' [-Wunused-variable] unsigned int tens; ^
Code
#include <stdint.h>#include <iostream>#include <vector>using namespace std;const uint64_t kerto[20] = { UINT64_C(1), UINT64_C(10), UINT64_C(100), UINT64_C(1000), UINT64_C(10000), UINT64_C(100000), UINT64_C(1000000), UINT64_C(10000000), UINT64_C(100000000), UINT64_C(1000000000), UINT64_C(10000000000), UINT64_C(100000000000), UINT64_C(1000000000000),UINT64_C(10000000000000), UINT64_C(100000000000000), UINT64_C(1000000000000000), UINT64_C(10000000000000000), UINT64_C(100000000000000000), UINT64_C(1000000000000000000), UINT64_C(10000000000000000000) };int calc(uint64_t i){uint64_t nums = 1U;uint64_t arvo = 1U;uint64_t limit = 9U;unsigned int tens;i--;while (i / limit >= nums) {const uint64_t vlimit = limit;i -= nums * limit;nums++;arvo *= 10U;limit *= 10U;if (limit <= vlimit)break;}arvo += i / nums;arvo /= kerto[(nums - 1) - (i % nums)];return arvo % 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;}main();}
Test details
Test 1
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 582 214 723 273 ... |
correct output |
---|
0 1 7 7 6 ... |
user output |
---|
(empty) |
Test 2
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 615664 916441 627600 279508 ... |
correct output |
---|
1 2 3 2 2 ... |
user output |
---|
(empty) |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 672274832941907421 260504693279721732 646999966092970935 100853063389774434 ... |
correct output |
---|
7 2 2 0 9 ... |
user output |
---|
(empty) |