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

Re:Idea .. .. ..

Posted by cypressx at 2004-12-08 01:33:05 on Problem 2140
In Reply To:Idea .. .. .. Posted by:cypressx at 2004-12-06 00:58:22
I tried with solving the equation :
p(p-1) - q(q-1) = N     // this comes from :
                        // if we want the sum from i to j we can 
                        // subtract the sum 1..j - 1..i 
                        // and for the sum 1..n we have a formula :
                        // n*(n-1)/2
it has complexity O(N) but it is too slow.
Anyone to give a hint ?

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