hdu 4004 The Frog's Games 二分查找
来源:互联网 发布:淘宝店新店如何推广 编辑:程序博客网 时间:2024/06/05 21:17
#include<iostream>#include<algorithm>#define a_max 500002using namespace std;int a[a_max];int main(){ int n, m, i; int l; while(scanf("%d%d%d", &l, &n, &m) != EOF) { int count; memset(a, 0, sizeof(a)); for( i=1; i <= n; i++ ) scanf("%d", &a[i]); a[i] = l; n += 2; sort(a, a+n); int first = 0, end, temp, p1, p2; end = l; while(end-first > 1) { bool p = false; count = 0; p1 = 0; p2 = 1; temp = (end+first) / 2; while(p2 < n) { while(a[p2] - a[p1] <= temp && p2 < n) p2++; if(a[p2] - a[p1] > temp && p2-p1 ==1) { first = temp; p = true; break; } p1 = p2-1; count++; } if(p == false) { if(count > m) first = temp; else { end = temp; } } } printf("%d\n", end); } return 0;}
- hdu 4004The 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】+ 二分
- 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(二分)
- 在 Windows Server 2012 上安装 ASP.NET STATE SERVICE
- 数据库范式以及数据库设计基本理论
- startActivityForResult() 跳转回来而没调用onActivityResult()
- windows核心编程--纤程
- HTML5----22个技巧
- hdu 4004 The Frog's Games 二分查找
- Struts 2中的constant含义
- 安卓开发历险记
- IE7/8下 Fiddler 无法本地调试的问题
- Writing a Winsock 2 Layered Service Provider(LSP) 译文(zz)(下)
- keystore提取私钥和证书
- luci笔记4,模板
- linux 如何卸载mysql
- Android: AirReceiver Project