Task: | Kyselyt |
Sender: | Jace |
Submission time: | 2017-10-04 03:14:28 +0300 |
Language: | Python3 |
Status: | READY |
Result: | 37 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 12 |
#2 | ACCEPTED | 25 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.09 s | 1 | details |
#2 | ACCEPTED | 0.09 s | 2 | details |
#3 | WRONG ANSWER | 0.14 s | 3 | details |
Code
from math import log, ceil from random import randint queries = [] count = int(input()) for _ in range(count): queries.append(int(input())) #for i in range(4): # print(len([_ for _ in range(1, 10000) if ceil(log(_, 10)) == i])) # print(ceil(log(10**i + 1, 10))*10**(i+1)*0.9 / (i+1)) # print(ceil(log(10**i + 1, 10))*10**(i+1)*0.9) # print() def group(x): i = 0 c = 0 while c + ceil(log(10**i + 1, 10))*10**(i+1)*0.9 < x: c += ceil(log(10**i + 1, 10))*10**(i+1)*0.9 i += 1 return i, c ##cc = "" ##for i in range(1, 10**8): ## cc += str(i) ## ##for i in range(10): ## l, s = group(i) ## if cc[i] != str(int(10**l + (i - s)//(l+1)))[int((i - s) % (l+1))]: ## print(i, '!!') ## ## ##while True: ## ## i = randint(10**7, 10**8-1) ## l, s = group(i) ## s += 1 ## ## if cc[i-1] != str(int(10**l + (i - s)//(l+1)))[int((i - s) % (l+1))]: ## print(cc[i]) ## print(cc[i-5:i+5]) ## print(str(int(10**l + (i - s)//(l+1)))[int((i - s) % (l+1))]) ## break ## else: ## print(i) for query in queries: #print('Q', query) #print('C', cc[query-1]) #print('G', group(query)) if query < 10: print(query) else: l, s = group(query) s += 1 #print(query - s, # (query - s)//(l+1), # 10**l + (query - s)//(l+1), # (query - s) % (l+1)) print(str(int(10**l + (query - s)//(l+1)))[int((query - s) % (l+1))]) #print('?')
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 |
---|
4 2 3 6 9 ... Truncated |