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

贴个公式在上面

Posted by ccnu_xieshuo at 2008-04-29 19:20:18 on Problem 2140
设起始数为i,连续数的个数为j,则最后一个数为j+i-1;推得(2*i+j-1)*j=2*n,n就是那个要分的数;因为2*i-1>0;所以(2*i+j-1)*j=2*n>j*j,所以j<sqrt(2*n),对于j满足2*n%j=0&&(2*n/j-j+1)%2=0.一个j对应一个i,j就是要求的数目。是个o(n)的算法,不知道有没有更快的

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