摘要: 01背包,想了解背包的可以看看这个https://oi-wiki.org/dp/knapsack/ #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> usi 阅读全文
posted @ 2020-02-09 19:48 Vetsama 阅读(87) 评论(0) 推荐(0)
摘要: 分组,对每组进行01背包,x存组数,ans存每组有几个 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; int 阅读全文
posted @ 2020-02-09 19:42 Vetsama 阅读(131) 评论(0) 推荐(0)
摘要: 终于出现完全背包了,想的冷笑话可以用了 这个题 完完全全是完全背包啊!!! #include <iostream> #include <cstdio> using namespace std; int max(int a, int b){ return a > b ? a : b; } int ma 阅读全文
posted @ 2020-02-09 19:33 Vetsama 阅读(67) 评论(0) 推荐(0)
摘要: 这个题是以前做的,当时还不会一维数组做背包(丢人),普普通通的01背包 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdlib> #include <cstring> #include <string> using 阅读全文
posted @ 2020-02-09 19:30 Vetsama 阅读(72) 评论(0) 推荐(0)
摘要: 01背包,没啥说的,顺说点题目无关的吧,01背包从后往前推,完全背包从前往后推,要小心越界 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using n 阅读全文
posted @ 2020-02-09 19:28 Vetsama 阅读(125) 评论(0) 推荐(0)
摘要: 依旧是有一些疯狂的想法,把配件和主件存入一个容器里,然后在对主件背包时,对队伍里面的配件进行背包 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #inc 阅读全文
posted @ 2020-02-09 19:25 Vetsama 阅读(117) 评论(0) 推荐(0)
摘要: 看到这个题,有了一个大胆的想法,对方案数进行背包,对于一个pos【钱数】就是把每种能买的菜的pos【钱数-菜价】加起来,POS存放的是方案数 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #in 阅读全文
posted @ 2020-02-09 19:17 Vetsama 阅读(94) 评论(0) 推荐(0)
摘要: 题目一看就是标准的01背包,只需要在计算前把价格和重要度先计算了就好 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using namespace st 阅读全文
posted @ 2020-02-09 19:04 Vetsama 阅读(76) 评论(0) 推荐(0)
摘要: Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irrever 阅读全文
posted @ 2020-02-02 19:56 Vetsama 阅读(151) 评论(0) 推荐(0)
摘要: A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program 阅读全文
posted @ 2020-02-02 18:42 Vetsama 阅读(165) 评论(0) 推荐(0)