ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1209. 1, 10, 100, 1000...

another hint
Posted by So Sui Ming 16 Jan 2024 19:23
Stack 1,10,100,1000,10000,100000,... vertically:

1
10
100
1000
10000
100000
...
the cumulative sums of digits from the top are:
1,3,6,10,15,21,... which are in the form of combination(N,2) = N*(N-1)/2

checking whether one is at Kth digit is the same as finding if there is integer solution to:
N*(N-1)/2 = K-1

one way is to solve the quadratic equation for N (in double) and cast N to integer and check the above relation.
regards,
So Sui Ming



Edited by author 16.01.2024 19:27

Edited by author 16.01.2024 19:27