传送门 https://www.cnblogs.com/violet-acmer/p/9793209.html 题意: 有 N 块岩石,从中去掉任意 M 块后,求相邻两块岩石最小距离最大是多少? 题解: 二分答案(假设答案为res) 定义 l = 0 , r = L ; mid = (l+r)/2 ; 判断当前答案 mid 至少需要去除多少块岩石,如果去除的岩石个数 > M,说明当前答案mid > res,r=mid;反之,说明当前答案 mid <= res , l =mid; AC代码…
描述 http://poj.org/problem?id=2456 有n个小屋,线性排列在不同位置,m头牛,每头牛占据一个小屋,求最近的两头牛之间距离的最大值. Aggressive cows Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10095   Accepted: 4997 Description Farmer John has built a new long barn, with N (2 <= N <=…
River Hopscotch Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9923   Accepted: 4252 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. T…
River Hopscotch Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6697   Accepted: 2893 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. T…
River Hopscotch Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9326   Accepted: 4016 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. T…
River Hopscotch Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9263 Accepted: 3994 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The e…
描述 http://poj.org/problem?id=3258 给出起点和终点之间的距离L,中间有n个石子,给出第i个石子与起点之间的距离d[i],现在要去掉m个石子(不包括起终点),求距离最近的两个石子(包括起终点)之间距离的最大值. River Hopscotch Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 10841   Accepted: 4654 Description Every year the co…
River Hopscotch Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 21939 Accepted: 9081 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The…
题目链接:http://poj.org/problem?id=3258 River Hopscotch Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 15753   Accepted: 6649 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully ju…
题目链接:http://poj.org/problem?id=3258 题意:给n个石头,起点和终点也是两个石头,去掉这石头中的m个,使得石头间距的最小值最大. 思路:二分石头间的最短距离,每次贪心地check一下是否满足条件即可,具体看代码. AC代码: #include<iostream> #include<stack> #include<vector> #include<algorithm> #include<cmath> using na…