ZOJ Problem Set - 3623Battle Ships
来源:互联网 发布:dvd视频制作软件 编辑:程序博客网 时间:2024/06/15 01:36
Link:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4769
完全背包
反向考虑造船和进攻的关系,枚举时间。
#include <iostream>#include <algorithm>#include <string.h>using namespace std;typedef long long ll;const int Len=40;const int N=400;int map[Len][2];int dp[N+50];int main(){ int n,l; while(cin>>n>>l){ memset(dp,0,sizeof(dp));for(int i=0;i<n;i++){ cin>>map[i][0]>>map[i][1];}for(int i=0;i<n;i++){ for(int j=0;j<N;j++){ dp[j+map[i][0]]=max(dp[j+map[i][0]],dp[j]+map[i][1]*j); }}for(int i=0;i<N;i++){if(dp[i]>=l){ cout<<i<<endl; break;}} }}
0 0
- ZOJ Problem Set - 3623Battle Ships
- ZOJ 3623 Battle Ships
- zoj 3623 Battle Ships
- ZOJ 3623 Battle Ships
- ZOJ 3623 Battle Ships
- ZOJ 3623 Battle Ships
- zoj 3623 battle ships
- ZOJ 3623 Battle Ships
- zoj 3623 Battle Ships dp
- zoj 3623 Battle Ships(dp)
- ZOJ 3623 Battle Ships(完全背包)
- 【神DP】-ZOJ-3623-Battle Ships
- ZOJ 3623 Battle Ships 简单DP
- ZOJ 3623 - Battle Ships(完全背包)
- ZOJ 3623 Battle Ships (完全背包)
- ZOJ 3623 Battle Ships(dp)
- ZOJ 3623 Battle Ships(完全背包)
- ZOJ-3623 Battle Ships (完全背包 应用题)
- 不忘初心
- ios8.0下CLLocationManager定位服务需要授权了
- github使用指南
- web开发学习笔记(1):dreamweaver+html+javascript第一个网页例子
- linux ps命令介绍
- ZOJ Problem Set - 3623Battle Ships
- gps平台 部标平台 源码
- 三种类型SD卡的对比
- Android开发菜鸟安装工具指导大全!!----菜冬瓜
- UDP通讯讲解,读写键盘录入信息
- NIOS II IP核
- 辗转相除法
- 高等数学(总结1-导数的几个定理)
- eclipse下,每次运行程序时,新启动Android模拟器(在已经有一个模拟器运行的情况)