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

我DP的,不知道标准答案是什么方法

Posted by palqing at 2011-03-20 16:05:29 on Problem 3783
我DP的。。
DP[m][n]表示m个球,n次机会,最多能在多少层楼的情况下检测出。
则
if(i>j) DP[i][j]=DP[j][j]; 
else DP[i][j]=DP[i-1][j-1]+DP[i][j-1]+1;

最后二分DP[ballnum]数组即可。
不过要注意中间可能DP的值超大,所以在上面两行之后加上一句:
if(DP[i][j]>10000) DP[i][j]=10000;
防止超范围

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