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 milksea at 2007-01-31 04:38:32 on Problem 2000
解不等式
(for k = 1 to i)∑k = i * (i + 1) / 2 ≤ n,
注意到i是满足上式的最小正整数,得到
i = √(8 * n + 1) - 1(取整数)
于是有:
金币数
= (for k = 1 to i)∑k^2 + (n - i) * (i + 1)
= (i + 1) * (6 * n - 2 * i - i^2) / 6

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