Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

hint

Posted by tayu at 2005-08-31 18:11:44 on Problem 1019
居高建瓴的解法
/*
我们考虑从N中先剥离出是Sn的第k项,然后再剥离出是Sk的第p1个数,最后剥离出是第p1个数的第p2位。
第一步,用逼近法,用N减去Sk的长度 (k=1, 2, ...),直到N<=Sk为止。
第二步,用逼近法,用N减去p*(10^p - 10^(p-1)) (p=1, 2, ...),直到N<=p*(10^p - 10^(p-1))为止,
此时的p即为第N个数字所在的数的位数。第三步,p1=N DIV p+1,p2=N MOD p,如果p2=0则p1=p1-1,p2=p2+p,
此时的p1表示p位数的第p1个数,p2表示p1的第p2位。最后一步,输出10^(p-1)+p1-1的第p2位数字,即为所求的答案。
*/

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator