HDU4004】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4004 大致题意 二分最大跳跃能力,判断是否可以在m次内到达对岸! 分析:由于求青蛙最小弹跳能力,所以二分不断枚举能力x,再对x判断是否在m次内到达对岸... #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <queue> #incl…
题目大意,有一条长度为L和河流,中间穿插n个石凳,青蛙跳m次经过石凳后到达对岸,求青蛙每次跳跃的最大距离的最小值 本题数据量大n<500000,显然简单的o(n*n)算法是通过不了的,在输入大量的数据使用scanf比使用cin快很多,而且cin会超时,scanf可以AC,大致思路是:青蛙跳跃能力的范围·在两个石凳间最大差值L0与两岸距离L之间,算法步骤如下: 1.求出两岸最大距离L0,二分左边界left=L0,右边界right=L 2判断mid=(left+right)>>1是否可以在跳…
第一道二分答案...今天看了大牛的博客,突然发现有个叫“二分枚举答案”的方法好像很牛,于是便搜了些资料..发现并不是很难,可能是我了解的只是冰山一脚罢了...加油ACMer!!!! #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; #define max 500000 int d[max],ans; int L,n,m; bool OK(int stp){     …
http://acm.hdu.edu.cn/showproblem.php?pid=4004 Problem Description The annual Games in frogs' kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the frog athlete…