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 |
测试数据太弱了,我这样的写的二分也都AC了int main(){ int lt, rt, mid, tag, i; while(scanf("%d %d", &n, &c)!=EOF){ for(i=0; i<n; i++) scanf("%d", &a[i]); sort(a,a+n); lt=a[0]; rt=a[n-1]; while(lt<=rt){ mid=(lt+rt)/2; if(check(mid)) lt=mid+1,tag=mid; else rt=mid-1; } printf("%d\n",tag); } return 0; } 我二分时取的lt=a[0]; rt=a[n-1]; 若数据为 3 2 100 101 102 时结果肯定错,但竟然AC了 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator