hdoj1257_最少拦截系统(dp)
2015-06-22 13:51
323 查看
#include<iostream> #include<vector> using namespace std; int input[30001]; vector<int> no; int solve(int n) { no.clear(); for (int i = 0; i < n; i++) { int j = 0; for (; j < no.size(); j++) { if (input[i] <= no[j]) { no[j] = input[i]; break; } } if (j == no.size()) no.push_back(input[i]); } return no.size(); } int main() { int n; while (cin >> n) { for (int i = 0; i < n; i++) cin >> input[i]; cout<<solve(n) << endl; } return 0; }
相关文章推荐
- linux找不到mysql.h(连接不到mysql.h)
- 第二阶段冲刺站立会议报告
- 错误容忍(故障容忍fault tolerance)
- 学习C++编程时,遇到过的小问题
- HTML URL 编码:请参阅:http://www.w3school.com.cn/tags/html_ref_urlencode.html
- 设计模式之模板方法模式
- windows系统日志与入侵检测详解-电脑教程
- SCP免密码传输
- BZOJ 2016: [Usaco2010]Chocolate Eating( 二分答案 )
- cocos js添加 按钮1
- Excel 筛选A列和B列共有的数据
- visual studio code 调试 sails.js
- 前端世界的憧憬
- onRetainNonConfigurationInstance和getLastNonConfigurationInstance
- maven parent中的dependencies和dependencyManagement区别
- Matlab中unifrnd函数使用解析
- android应用程序的安装方式与原理
- 在Qt5.4中调用 sql server 2008 的存储过程如何获取返回值
- 为什么整个互联网行业都缺前端工程师?
- 多线程知识点3