USACO Section 3.1 Score Inflation(完全背包)
来源:互联网 发布:粤语网络女歌手排行榜 编辑:程序博客网 时间:2024/05/17 16:55
完全背包。模版题,可以用滚动数组优化。
#include<cstdio>#include<algorithm>#include<cmath>#include<queue>#include<cstring>#include<iostream>using namespace std;typedef long long LL;/*ID: kkkwjx1PROG: inflateLANG: C++*/const int maxn=10005;int dp[maxn];int w[maxn],v[maxn];int main(){ freopen("inflate.in","r",stdin); freopen("inflate.out","w",stdout); int n,m; scanf("%d%d",&m,&n); for(int i=1; i<=n; ++i) scanf("%d%d",&w[i],&v[i]); for(int i=1; i<=n; ++i) { for(int j=0; j<=m; ++j) if(j>=v[i]) dp[j]=max(dp[j],dp[j-v[i]]+w[i]); } printf("%d\n",dp[m]); return 0;}
0 0
- USACO Section 3.1 Score Inflation(完全背包)
- USACO section 3.1 Score Inflation(DP背包)
- USACO 3.1 Score Inflation (完全背包) P2722 总分 Score Inflation
- USACO--3.1Score Inflation+完全背包问题
- USACO 3.1 Score Inflation (完全背包)
- 1683 USACO 3.1 Score Inflation (完全背包)
- USACO Score Inflation,完全背包问题
- USACO Score Inflation,完全背包问题
- usaco Chapter 3 section 3.1 Score Inflation
- USACO-Section 3.1-PROB Score Inflation
- USACO-Section 3.1 Score Inflation(DP)
- USACO Section 3.1 Score Inflation - USACO的机器好强大~~
- USACO 3.1 Score Inflation
- 【完全背包】Score Inflation 总分
- USACO 3.1.2 Score Inflation
- USACO 3.1 Score Inflation (inflate)
- usaco Score Inflation
- usaco Score Inflation
- 史上最易懂的Android jni开发资料--NDK环境搭建
- Scala如何驾驭大规模系统?
- Eclipse/MyEclipse安装FindBugs
- 支持向量机-核函数
- Mac下PHP安装Memcache扩展
- USACO Section 3.1 Score Inflation(完全背包)
- HDU 1513 Palindrome(DP)
- Source Code of Java - Long
- tomcat结合nginx使用小结
- 相对虚拟地址,虚拟地址,文件偏移地址
- ruby 学习日志1
- 面试题:关于Objective-C中的回调机制
- Android-获取View 的坐标和屏幕高度、状态栏高度、标题栏高度
- lepus 一键安装脚本