摘要: 题目地址:http://poj.org/problem?id=1064有N条绳子,它们的长度分别为Ai,如果从它们中切割出K条长度相同的绳子,这K条绳子每条最长能有多长。二分绳子长度,然后验证即可。复杂度o(nlogm) 1 #include 2 #include 3 #include 4 #inc... 阅读全文
posted @ 2015-03-19 16:29 SXISZERO 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 时间复杂度o(nlogn)。STL中为lower_bound,upper_bound。 1 int bin_search(int *a,int h,int t,int k) 2 { 3 int lb=h-1,ub=t; 4 5 while(ub-lb>1) { 6 ... 阅读全文
posted @ 2015-03-19 16:24 SXISZERO 阅读(145) 评论(0) 推荐(0) 编辑