完全背包 battle ships
来源:互联网 发布:mac 挂载移动硬盘 编辑:程序博客网 时间:2024/05/21 16:15
Battle Ships
ZOJ - 3623
自己真菜,,没法独立写出这道题。
这道题自己遇到的问题就是如何表示建造后 船每秒都造成伤害。。
看了discuss, 他们是假定先建造好了,然后看造成的伤害。
see code
#include<iostream>#include<string>#include<cstring>#include<algorithm>#include<iomanip>#include<queue>#include<cmath>#include<set>#include<cstdio>using namespace std;struct Node{ int c,v;}node[35];int dp[400];int main(){ int n,l; while(~scanf("%d%d",&n,&l)){ memset(node,0,sizeof(node)); for(int i=1;i<=n;++i){ scanf("%d%d",&node[i].c,&node[i].v); } memset(dp,0,sizeof(dp)); for(int i=1;i<=333;++i){ for(int j=1;j<=n;++j){ dp[i+node[j].c]=max(dp[i+node[j].c],dp[i]+node[j].v*i);//这个地方他们想的真好。 从当前往后面推 } } int ans; for(int i=1;i<=333;++i){ if(dp[i]>=l){ ans=i;break; } } printf("%d\n",ans); }}
0 0
- Battle Ships(完全背包)
- 完全背包 battle ships
- ZOJ3623:Battle Ships(完全背包)
- ZOJ 3623 Battle Ships(完全背包)
- ZOJ 3623 - Battle Ships(完全背包)
- ZOJ 3623 Battle Ships (完全背包)
- ZOJ3623 Battle Ships (完全背包)
- ZOJ3623: Battle Ships(类完全背包)
- ZOJ 3623 Battle Ships(完全背包)
- ZOJ-3623 Battle Ships (完全背包 应用题)
- TOJ 4365 ZOJ 3623 Battle Ships / 完全背包
- ZOJ - 3623 Battle Ships(完全背包或者BFS)
- Battle Ships
- ZOJ 3623 Battle Ships 造战舰炸塔 动态规划 伪装较好的完全背包 ★★★
- ZOJ - 3623 - Battle Ships (01背包变形)
- ZOJ 3623 Battle Ships
- zoj 3623 Battle Ships
- ZOJ 3623 Battle Ships
- git提交代码
- mysql 5.7 忘记root密码 修改密码
- 资源共享(Smart C++ 和 Cena 评测系统)
- Xcode + Github
- 我找不出自己的代码哪里错了你知道吗
- 完全背包 battle ships
- 2017 4C 赛后总结
- 非常可乐 HDU
- 深入理解java异常处理机制
- 在CentOS上一键安装OpenStack
- RecyclerView简单使用介绍
- mysql主从数据不同步
- 国际化
- 网络编程系列二--最简单的网络程序