CSES - Datatähti 2018 alku - Results
Submission details
Task:Kyselyt
Sender:Kurns
Submission time:2017-10-05 17:31:35 +0300
Language:Python3
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.08 s1details
#20.08 s2details
#30.07 s3details

Code

import math

userInput = int(input())
asks = []
for l in range(0, userInput):
    asks.append(input())
D = []

D.append(0)
D.append(9)
D.append(180)
D.append(2700)
D.append(36000)
D.append(450000)
D.append(5400000)
D.append(63000000)
D.append(720000000)
D.append(8100000000)
D.append(90000000000)
D.append(990000000000)
D.append(1800000000000)
D.append(11700000000000)
D.append(126000000000000)
D.append(1350000000000000)
D.append(14400000000000000)
D.append(153000000000000000)
D.append(1640000000000000000)
D.append(17300000000000000000)
D.append(182000000000000000000)

for g in range(0, len(asks)):
    pituus = len(asks[g])

    ELS = 0
    for x in range(1, len(asks[g])):
        ELS += D[x]
  
    remainingDigits = int(asks[g])-ELS


    res = math.floor((remainingDigits-1)/pituus)
    over = remainingDigits%pituus

    h = "0"
    for k in range(0, pituus-1):
        if k == 0:
            h = "10"
        else:
            h += "0"
        
    currNum = int(res) + int(h)
    #print("res on", res, "remainingDigits on", remainingDigits, "over on", over, "ja currNum on", currNum)
    print(str(currNum)[over-1])
    
    

Test details

Test 1

Group: 1

Verdict:

input
1000
582
214
723
273
...

correct output
0
1
7
7
6
...

user output
0
1
7
7
6
...

Test 2

Group: 2

Verdict:

input
1000
615664
916441
627600
279508
...

correct output
1
2
3
2
2
...

user output
1
2
3
6
9
...

Test 3

Group: 3

Verdict:

input
1000
672274832941907421
260504693279721732
646999966092970935
100853063389774434
...

correct output
7
2
2
0
9
...

user output
5
5
8
2
5
...