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 |
见内In Reply To:Re:用笨办法太慢了,高手能指点指点吗? Posted by:chqch172443 at 2008-07-08 16:17:44 假设num能分解成从j开始的连续i个数的和,则有i*j+i*(i-1)/2=num; 即i(2*j+i-1)=2*num,则j=(num-i*(i-1)/2)/i;j是大于0的整数,则(num-i*(i-1)/2)%i应为0,然后且满足j>=1即(num-i*(i-1)/2>=i,整理即得:i*(i+1)<=2*num; ~over~ Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator