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 |
求教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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator