题目链接

题意理解的有些问题。

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define LL __int64
LL p[];
int n;
int judge(int x,int m)
{
int pre = ,num = ,i;
for(i = ;i <= n;i ++)
{
if(p[i] - pre <= x)
;
else
{
num ++;
pre = p[i-];
}
}
if(num + > m)
return ;
else
return ;
}
int main()
{
int m,i,l;
LL str,mid,end,minz;
while(scanf("%d%d%d",&l,&n,&m)!=EOF)
{
for(i = ; i < n; i ++)
scanf("%I64d",&p[i]);
sort(p,p+n);
if(n == ||m == )
{
printf("%d\n",l);
continue;
}
p[n] = l;
minz = p[];
for(i = ;i < n;i ++)
{
minz = max(minz,p[i+]-p[i]);
}
str = minz;end = l;
while(str < end)
{
mid = (str+end)/;
if(judge(mid,m) == )
str = mid + ;
else
end = mid;
}
printf("%I64d\n",str);
}
return ;
}

HDU 4004 The Frog's Games(二分)的更多相关文章

  1. HDU 4004 The Frog's Games(二分答案)

    The Frog's Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) ...

  2. HDU 4004 The Frog's Games(二分+小思维+用到了lower_bound)

    The Frog's Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) ...

  3. HDU 4004 The Frog's Games(2011年大连网络赛 D 二分+贪心)

    其实这个题呢,大白书上面有经典解法  题意是青蛙要跳过长为L的河,河上有n块石头,青蛙最多只能跳m次且只能跳到石头或者对面.问你青蛙可以跳的最远距离的最小值是多大 典型的最大值最小化问题,解法就是贪心 ...

  4. hdu 4004 The Frog's Games

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4004 The annual Games in frogs' kingdom started again ...

  5. 杭电 4004 The Frog's Games 青蛙跳水 (二分法,贪心)

    Description The annual Games in frogs' kingdom started again. The most famous game is the Ironfrog T ...

  6. D - The Frog's Games (二分)

    The annual Games in frogs' kingdom started again. The most famous game is the Ironfrog Triathlon. On ...

  7. The Frog's Games(二分)

    The Frog's Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) ...

  8. HDUOJ----4004The Frog's Games(二分+简单贪心)

    The Frog's Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) ...

  9. HDU 4004 二分

    The Frog's Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) ...

随机推荐

  1. GPS NEMA 0183协议

    转自:http://www.cnblogs.com/xidongs/archive/2011/02/01/1948689.html 一. NMEA0183标准语句(GPS常用语句)$GPGGA例:$G ...

  2. JavaScript 火花效果

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  3. golang exec Command

    package mainimport ( "fmt" "log" "os/exec")func main() { out, err := e ...

  4. APUE包含头文件"apue.h"问题

    下载源码 从unix高级编程书籍官网下载书籍的上的所有源码. wget http://www.apuebook.com/src.tar.gz 解压这个文件 tar -zxvf src.tar.gz 解 ...

  5. Android开发学习笔记:浅谈WebView(转)

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://liangruijun.blog.51cto.com/3061169/647456 ...

  6. MarkupExtension

    —目的 如果要在XAML里引用静态或动态对象实例,或在XAML中创建带有参数的类.这时,我们需要用到XAML扩展.XAML扩展常用来设定属性值.使用标识扩展,告诉 XAML 处理不要像通常那样将属性值 ...

  7. ios本地推送

    #import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate //无论程序在 ...

  8. github 使用网址

    [Github教程]史上最全github使用方法:github入门到精通 http://blog.csdn.net/hcbbt/article/details/11651229 githup的使用 h ...

  9. 【主席树】【bzoj2161】[hdu4348]

    #include<cstdio> #include<algorithm> #include<cstring> #define N 400000 using name ...

  10. LaunchCharacter

    /** Set a pending launch velocity on the Character. This velocity will be processed on the next Char ...