Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:Idea .. .. ..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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator