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 majia5 at 2010-09-16 18:54:52 on Problem 2289 and last updated at 2010-09-16 18:57:46
void work(){
	int l,r,mid;
	l = 1; r = n;
	while(l < r){
		mid = (l + r) >> 1;
		if( ok(mid) ) r = mid - 1;else l = mid + 1;
	}
	mid = max(1, mid - 50);
	//cout <<"mid = " << mid <<endl; 
	if(!ok(mid)) ++ mid ;
	printf("%d\n", mid );
}
WA 



void work(){
	int l,r,mid;
	l = 1; r = n;
	while(l < r){
		mid = (l + r) >> 1;
		if( ok(mid) ) r = mid ;else l = mid + 1;
	}
	printf("%d\n", r );
}

AC

我实在不明白为啥,求大牛指点……

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