九度oj 题目1152 点菜问题
来源:互联网 发布:红猫网络加速 编辑:程序博客网 时间:2024/05/23 19:11
#include<iostream> #include<cmath> #include<cstring> #include<algorithm> using namespace std;int dp[10005];int main(){int i,j,k,m,n;int C;while(cin>>C>>n){int v[105],p[105];for(i=1;i<=n;i++)cin>>p[i]>>v[i];memset(dp,0,sizeof(dp));for(i=1;i<=n;i++)for(j=C;j>=p[i];j--)dp[j]=max(dp[j],dp[j-p[i]]+v[i]);cout<<dp[C]<<endl;}}
0 0
- 九度oj 题目1152 点菜问题
- 九度OJ 题目1152:点菜问题
- 九度oj-1152-点菜问题
- 九度OJ - 1152 - 点菜问题
- 九度OJ 1152:点菜问题 (01背包、DP)
- 题目1152:点菜问题
- 题目1152:点菜问题
- 题目1152:点菜问题
- 题目1152:点菜问题
- 九度OJ题目1554:区间问题
- 九度oj 题目1104:整除问题
- 九度OJ 题目1006:ZOJ问题
- 九度 oj 题目1104:整除问题
- 九度 oj 题目1006:ZOJ问题
- 九度 oj 题目1554:区间问题
- 九度 oj 题目1552:座位问题
- 九度 oj 题目1549:货币问题
- 九度oj 题目1008:最短路径问题
- python编程问题...
- linuxproxy设置
- Java 实现视频转FLV,支持完成进度百分比
- PHP获取Cookie模拟登录CURL
- 第九周(例题)——课本例题的熟悉。
- 九度oj 题目1152 点菜问题
- C# 通过Reflection代码实现载入内置的(dll)资源文件
- 【linux驱动分析】之dm9000驱动分析(七):dm9000的卸载挂起和恢复以及打开和停止
- 正向代理与反向代理的区别
- 第九周项目五
- Eclipse: convert “dynamic web module” to “web fragment module”
- 关于typedef的用法总结
- C++ 访问http接口
- C/C++日常学习总结(第一篇)const用法及printf的执行顺序