怒刷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 ...
随机推荐
- spring+jpg环境下,spring实现文件下载web实现通用的文件下载方法
jar包复制到WEB-INF 文件夹lib下: commons-io-1.3.2.jar public static String download(HttpServletRequest reques ...
- spring+jpg环境下,spring实现文件上传
jsp: <form method="post" action="excel.do?method=inputExcel" enctype="mu ...
- Windows下使用NIF扩展Erlang方法
在Erlang中,NIF(Native Implemented Function)被用来扩展erlang的某些功能,一般用来实现一些erlang很难实现的,或者一些erlang实现效率不高的功能. N ...
- Animation Spinner【项目】
https://github.com/vjpr/healthkick/blob/master/src/win/healthkick/ucSpinnerCogs.xaml 网上的例子,放在UserCon ...
- Web服务器(CassiniDev的裁减版)
做此程序的原因是将软件部署简化,省去IIS的麻烦部署,减少项目实施人员的工作量和工作复杂度 Server sv = , "/", @"D:\web", IPAd ...
- VC++内存区域
转载声明:本文转载自http://blog.csdn.net/sjxbf/article/details/6441730 一.预备知识—程序的内存分配 一个由c/c++编译的程序占用的内存分为以下几个 ...
- NAT类型与穿透 及 STUN TURN 协议
STUN : Simple Traversal of User Datagram Protocol [UDP] Through Network Address Translators [NATs] S ...
- ProbS CF matlab源代码(二分系统)(原创作品,转载注明出处,谢谢!)
%ProbS clear all;%% 数据读入与预处理 data = load('E:\network_papers\u1.base');test = load('E:\network_papers ...
- tomcat配置文件server.xml具体解释
元素名 属性 解释 server port 指定一个port,这个port负责监听关闭tomcat 的请求 shutdown 指定向port发送的命令字符串 service name 指定servic ...
- 浏览器禁用Cookie,基于Cookie的会话跟踪机制失效的解决的方法
当浏览器禁用Cookies时.基于Cookie的会话跟踪机制就会失效.解决的方法是利用URL重写机制跟踪用户会话. 在使用URL重写机制的时候须要注意.为了保证会话跟踪的正确性,全部的链接和重定向语句 ...