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:这题一定要用right才能ac...二分的输出应该怎么确定啊?

Posted by The_Dawn at 2011-07-12 20:08:56 on Problem 2456
In Reply To:这题一定要用right才能ac...二分的输出应该怎么确定啊? Posted by:iYao at 2010-05-17 21:13:42
你可以每次在确定了一个可行解后将它用ans记录一下,最后再输出ans就行。

while l<=r do
  begin
    mid:=(l+r)div 2;
    if OK(mid) then begin ans:=mid;l:=mid+1; end else r:=mid-1; 
  end;

writeln(ans);

这样..

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