
三分查找
文章平均质量分 59
Yang彡
嗯 加油
展开
-
HDU 2899
Strange fuctionProblem Description Now, here is a fuction:F(x) = 6 * x7+8*x6+7x3+5*x2-yx (0 <= x <=100)Can you find the minimum value when x is between 0 and 100.Inp...原创 2018-11-04 12:23:31 · 274 阅读 · 0 评论 -
二分与三分查找模板
二分查找a[] 是有序的 成升序或降序int find(int a[])//假定是在0到100之间搜索 l取最左边 r 取最右边{int l=0;int r=100;int m;while(l<r){m=(l+r)/2;if(a[m]==m) return m;else if(a[m]<m) r=m-1;else l=m+1;}return -1;}...原创 2018-11-04 21:00:16 · 379 阅读 · 0 评论