上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 有n种物品和容量为v的背包,每种物品可无限次使用,放入的费用是ci,价值是wi,求价值最大 #include<stdio.h> #include<algorithm> using namespace std; const int maxn=1e3+6; int n; int c[maxn],w[ma 阅读全文
posted @ 2021-08-18 18:48 废柴废柴少女 阅读(43) 评论(0) 推荐(0)
摘要: 01背包变形(背包容量大) 转化成能够达到的最大价值 https://vjudge.net/problem/FZU-2214/origin #include<stdio.h> #include<algorithm> using namespace std; const int maxn=1e3+6; 阅读全文
posted @ 2021-08-18 18:35 废柴废柴少女 阅读(88) 评论(0) 推荐(0)
摘要: f[i]表示一定选a[i]的字串的最大值 #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 1005; const int inf=1e9; int n 阅读全文
posted @ 2021-08-18 11:12 废柴废柴少女 阅读(37) 评论(0) 推荐(0)
摘要: #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 1005; int n, k; int a[maxn],f[maxn]; //最长不下降子序列 int 阅读全文
posted @ 2021-08-18 10:58 废柴废柴少女 阅读(19) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/19506/F 没注意到输入里有个k,循环里也用了个k; dp[i][j]表示i个盒子放j本书的最小面积 #include <cstdio> #include <algorithm> using namespace std; t 阅读全文
posted @ 2021-08-18 10:40 废柴废柴少女 阅读(26) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/19506/D 用总数减去不相交的区间个数和的最大值(区间是一个数出现 的left和right) 再对right从小到大排序 对a[i]离散化 #include<stdio.h> #include<bits/stdc++.h> 阅读全文
posted @ 2021-08-17 20:22 废柴废柴少女 阅读(38) 评论(0) 推荐(0)
摘要: 如果后来的和以前的发生矛盾,则以前的优先退让。 如果以前的退让之后没有cp可处,则以前的拒绝退让,新来的去寻找下一个匹配。 如果新来的谁也匹配不上了,那就这么单着吧 #include<stdio.h> #include<string.h> #include<algorithm> #include<b 阅读全文
posted @ 2021-08-14 10:09 废柴废柴少女 阅读(45) 评论(0) 推荐(0)
摘要: 题目: https://www.luogu.com.cn/problem/P4084 如果被染色了,只有一种染色方式,其他的为0 没被染色的,三种都可以 链式前向星存图 #include<stdio.h> typedef long long ll; const int maxn=1e5+7; con 阅读全文
posted @ 2021-08-13 10:44 废柴废柴少女 阅读(32) 评论(0) 推荐(0)
摘要: 题目: https://www.luogu.com.cn/problem/P4462 利用的异或的前缀和性质, 有多少个区间[l,r]满足异或起来为k异或满足前缀和 有多少个sumr^sum(l-1) =k sum(l-1) =k^sumr 要将l换成l-1 #include<bits/stdc++ 阅读全文
posted @ 2021-08-12 10:15 废柴废柴少女 阅读(40) 评论(0) 推荐(0)
摘要: 题目: https://www.luogu.com.cn/problem/P3901 #include<bits/stdc++.h> #include<stdio.h> using namespace std; const int maxn=1e5+7; int n,m,block,belong[m 阅读全文
posted @ 2021-08-12 09:40 废柴废柴少女 阅读(41) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 10 下一页