博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
The Preliminary Contest for ICPC Asia Shenyang 2019 C Dawn-K's water (完全背包)
阅读量:3897 次
发布时间:2019-05-23

本文共 365 字,大约阅读时间需要 1 分钟。

完全背包为什么要取到M,可以取到2*M嘛,这题需要整取,对于不能整取的背包容量,dp[k]=INF,以及dp[j-water[i].weight]=INF时,dp[j]也不需要更新。如果不整取的话,后面无法得知背包是否装满了,只知道,背包容量为m时,所花的最小消耗是多少,但是此时背包可能没装满。

#include 
using namespace std;typedef long long ll;const int INF=0x3f3f3f3f;const int N=2e4+10;struct Node {
int w,v;}wat[1010];ll dp[N],weight[N];bool cmp(const Node &a,const Node &b){
return a.w

转载地址:http://xruen.baihongyu.com/

你可能感兴趣的文章
ulimit 里的 file size 的 block 单位是多少?
查看>>
linux下查看端口对应的进程
查看>>
将 gdb 用作函数跟踪器 (Function Tracer)
查看>>
原 GCC一些有用的技巧
查看>>
yum 变量追加的方法
查看>>
2倍速的下一代Bluetooth,「Bluetooth 5」发布
查看>>
Top 10 “Yum” installables to be productive as a developer on Red Hat Enterprise Linux
查看>>
[小技巧] Vim 如果去除 “existing swap file” 警告
查看>>
如何在linux下检测内存泄漏
查看>>
十年生聚,Vim 8.0 发布了!
查看>>
【演歌】加賀の女 歌词翻译
查看>>
東京音頭 (东京音头) 歌词翻译
查看>>
Windows 7 下登录界面里 Ctrl + Alt + Del 无法使用
查看>>
惠山赏菊 & 梅园赏桂
查看>>
[小技巧] cat /proc/modules 显示的地址为 0
查看>>
[游戏] chrome 的小彩蛋
查看>>
napi
查看>>
_GNU_SOURCE和__USE_GNU的差别
查看>>
Linux 有了 “DTrace”
查看>>
Linux 系统中僵尸进程
查看>>