• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

开始刷\(DP\)题了,因为搜索练完了,qwq

这应该很痛苦吧,囤了好多题单,从大多是橙题,黄题,到全是蓝题紫题

那就开动了!

1 - P1049 [NOIP2001 普及组] 装箱问题

原题链接

https://www.luogu.com.cn/problem/P1049

思路

背包问题经典

蒟蒻代码

#包含位/标准数据h。

#定义重新注册

#定义rep(i,a,b)for(re int I=a;I=b;我)

#define per(i,a,b)for(re int I=a;I=b;我-)

使用命名空间标准

const int V=2 E4 5;

常数int N=35

int n,m;

int v[N];

int f[V];

int main()

{

IOs : sync _ with _ stdio(0);

时钟_ t C1=时钟();

#ifdef本地

freopen('data.in ',' r ',stdin);

freopen('data.out ',' w ',stdout);

#endif

//======================================================================

cinmn

rep(i,1,n)cinv

rep(i,1,n)

per(j,m,v)

f[j]=max(f[j],f[j-v]v);

coutm-f[m];

//======================================================================

end:

cerr ' Time used : ' clock()-C1 ' ms ' endl;

返回0;

}

Link to comment
Share on other sites