The Frog’s Games(hdu 4004)
来源:互联网 发布:linux将文件夹打包 编辑:程序博客网 时间:2024/04/29 10:10
http://acm.hdu.edu.cn/showproblem.php?pid=4004
#include <stdio.h>#include<algorithm>#define MAX 500005using namespace std;int stone[MAX];intl,n,m,i,j; int success(int jump){ int cnt=0; i=1; j=0; if(jump*m<l) return0; while(i<=n+1){ cnt++; if(jump<stone[i]-stone[j]) return 0; while(jump>=stone[i]-stone[j]&&i<=n+1) i++; j=i-1; } if(cnt>m) return0; return 1;}int judge(){ int left=0,right=l,mid; while(left<=right){ mid=(left+right)>>1; if(success(mid)) right=mid-1; else left=mid+1; } return left;}int main(){ while(~scanf("%d%d%d",&l,&n,&m)){ stone[0]=0; for(i=1;i<=n;i++) scanf("%d",&stone[i]); stone[n+1]=l; sort(stone,stone+n+2); printf("%d\n",judge()); } return 0; }
0 0
- HDU 4004 THE FROG’S GAMES(二分)
- HDU 4004 The Frog's Games
- hdu 4004 The Frog's Games
- HDU 4004 The Frog's Games
- HDU 4004 The Frog's Games
- HDU 4004 The Frog's Games
- hdu 4004 The Frog's Games
- hdu 4004 The Frog's Games
- HDU 4004 The Frog's Games
- hdu 4004 The Frog's Games
- hdu 4004 The Frog's Games
- HDU 4004 The Frog's Games(二分)
- The Frog’s Games(hdu 4004)
- HDU 4004 The Frog's Games(二分)
- hdu 4004 - The Frog's Games
- HDU 4004 The Frog's Games
- HDU 4004 The Frog's Games
- HDU 4004 The Frog's Games
- Monkey and Banana hdu(1069)
- 报错:Link of class 'Lcom/.../PersistentConnectionListener;' failed ...VFY: unable to resolve new-insta
- A Problem With Fibonacci Sequence
- nginx常见错误---持续更新
- Similar Word
- The Frog’s Games(hdu 4004)
- hdu1003
- poj 1067
- 由poj 1067引发的——取石子游…
- 火星A+B
- hdu 1005
- hdu(1166)敌兵布阵
- hoj2651(二分)
- 最大递增子数列