怒刷DP之 HDU 1257
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
System Crawler (2015-09-07)
Description
怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统.
Input
Output
Sample Input
Sample Output
#include <iostream>
#include <cstdio>
#include <string>
#include <queue>
#include <vector>
#include <map>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <climits>
using namespace std; const int INF = 0x7fffffff;
vector<int> DP; int main(void)
{
int n,box; while(scanf("%d",&n) != EOF)
{
DP.clear();
while(n --)
{
scanf("%d",&box);
int loc = ;
int min = INF;
for(int i = ;i < DP.size();i ++)
if(DP[i] - box >= && DP[i] - box < min)
{
min = DP[i] - box;
loc = i;
}
if(min == INF)
DP.push_back(box);
else
DP[loc] = box;
}
printf("%d\n",DP.size()); } return ;
}
怒刷DP之 HDU 1257的更多相关文章
- 怒刷DP之 HDU 1160
FatMouse's Speed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Su ...
- 怒刷DP之 HDU 1260
Tickets Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Stat ...
- 怒刷DP之 HDU 1176
免费馅饼 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- 怒刷DP之 HDU 1087
Super Jumping! Jumping! Jumping! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64 ...
- 怒刷DP之 HDU 1114
Piggy-Bank Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit S ...
- 怒刷DP之 HDU 1069
Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- 怒刷DP之 HDU 1024
Max Sum Plus Plus Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- 怒刷DP之 HDU 1029
Ignatius and the Princess IV Time Limit:1000MS Memory Limit:32767KB 64bit IO Format:%I64d &a ...
- HDU 1257 最少拦截系统 (DP || 贪心)
最少拦截系统 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
随机推荐
- myeclipse 8.5安装freemarker插件方法
1. 下载freemarker最新版本,目前本人下载时最新版本是:freemarker-ide-0.9.14.zip, ide版本的freemarker.jar版本太低,可以替换成高级版本,并修改me ...
- java(2014)实现对mysql数据库分页的代码
package util; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultS ...
- IIS7下.NET4.0 网站UrlRewriter.dll重写无后缀路径 失效
解决方法: 1.添加通配符脚本映射,选择:C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 2.找到和网站相对的连接池,选择 ...
- [读书笔记]ASP.NET的URL路由引擎
作用 一般的URL: 举例:http://www.myapp.com/app.aspx?id=2&sessionid=29320xafafa02fa0zga0g8a0z 缺点: 不美观,不清晰 ...
- Ehcache(07)——Ehcache对并发的支持
http://haohaoxuexi.iteye.com/blog/2119733 Ehcache对并发的支持 在高并发的情况下,使用Ehcache缓存时,由于并发的读与写,我们读的数据有可能是错误的 ...
- Ehcache(06)——监听器
http://haohaoxuexi.iteye.com/blog/2119353 监听器 Ehcache中监听器有两种,监听CacheManager的CacheManagerEventListene ...
- linux 压缩与解压缩
tar 命令详解 -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可 ...
- Celery学习笔记
转载请注明出处:点我 我的第一篇博客!嘿嘿! 在公司实习,接触到的第一个项目就用到了Celery,之前是完全没有接触过Celery这玩意,然后花了点时间仔细的研究了下怎么用.在学习过程中也遇到了些问题 ...
- Properties 转换成Map
转自:http://feitianbenyue.iteye.com/blog/1759259 对于Properties 转换成Map 的问题: 第一时间想到的肯定有以下: 1. 迭代出来 再 pu ...
- android之多媒体篇(一)
Android 4.0.3(Api Level 15)支持的多媒体格式. 注意:有些设备可能支持其他的文件格式. 1.Audio AAC LC/LTP.HE-AACv1(AAC+).AMR-NB.AM ...