![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
背包
mmk27
这个作者很懒,什么都没留下…
展开
-
HDU - 3092 Least common multiple 分组背包
Partychen like to do mathematical problems. One day, when he was doing on a least common multiple(LCM) problem, he suddenly thought of a very interesting question: if given a number of S, and we divid...原创 2018-09-10 12:13:33 · 170 阅读 · 0 评论 -
Contest1776 - 2019年第二阶段我要变强个人训练赛第九场 2019xupt-acm校赛
链接:http://icpc.upc.edu.cn/contest.php?cid=1776 A:括号匹配2019 猜的,证明等会了再补上 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=110; const ll mod=1e9+7; int n,k; char s[...原创 2019-06-30 23:19:54 · 190 阅读 · 0 评论 -
2019西安邀请赛 Miku and Generals 二分图+背包
题目链接:https://nanti.jisuanke.com/t/39271 题意:n个权值,分成两组,使他们的权值和的差最小,第一个大于等于第二个,其中有些点是相互矛盾的,不能分在同一组 题解:先把相对立的记录下来假设为:A1<->B1,A2<->B2...(Ai>Bi),那么我们就把A看成是B +( A-B),对于这两组,每一组肯定有一个B,其中一组要A-B...原创 2019-05-30 12:28:21 · 244 阅读 · 0 评论 -
ZOJ - 3956 Course Selection System 公式转化为 0 1背包
题目链接:点击查看 题意:给出n个,hi和ci,随便选出m个来,要求这个最大, 即 sum(H)*(sum(H)- sum(C)) - sum(C) * sum(C)最大,因为c最大为100,一共100个,所以我们就可以吧C的总和作为背包容量,求一个最大的H和了 #include<bits/stdc++.h> using namespace std; typedef lon...原创 2019-04-05 12:42:28 · 101 阅读 · 0 评论 -
ZOJ - 2955 Interesting Dart Game 鸽巢原理+完全背包
题目链接:点击查看 题意:一共有m种得分方式,要得到n分,至少多少次 题解:因为这个n有1e9,不能直接用背包去写,赛后看了题解->鸽巢原理:点击查看 因此就先把分数最大的平方先拿出来,在完全背包就OK了 #include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f int n,m; int dp...原创 2019-03-27 14:39:02 · 233 阅读 · 0 评论 -
POJ - 1947 Rebuilding Roads 树形dp+分组背包
The cows have reconstructed Farmer John's farm, with its N barns (1 <= N <= 150, number 1..N) after the terrible earthquake last May. The cows didn't have time to rebuild any extra roads, so now...原创 2018-11-14 16:42:16 · 131 阅读 · 0 评论 -
CodeForces - 232B Table 背包的味道+组合数
John Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n ...原创 2018-11-08 17:26:00 · 186 阅读 · 0 评论 -
HDU - 3578 Greedy Tino 01背包 设基准点
Tino wrote a long long story. BUT! in Chinese... So I have to tell you the problem directly and discard his long long story. That is tino want to carry some oranges with "Carrying pole", and he mus...原创 2018-10-31 12:27:13 · 259 阅读 · 0 评论 -
HDU - 2639 Bone Collector II 01背包之第k优解
The title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you haven't seen it before,it doesn't matter,I will give you a...原创 2018-09-10 12:21:26 · 135 阅读 · 0 评论 -
2018 焦作网络赛 Transport Ship 多重背包
题目链接:https://nanti.jisuanke.com/t/A2021 题解:给的数据,好像在告诉你怎么做,把每个一拆出来就好了 #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; int n, q; ll dp[10010], val[41...原创 2019-08-02 23:46:05 · 128 阅读 · 0 评论