上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: 与01背包结合的: #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn][maxn]; int main(){ int n,V,M;cin>>n>>V>>M; for(int i=1;i<=n; 阅读全文
posted @ 2021-02-04 20:03 Anonytt 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 不优化朴素解法,01背包看出S=1,完全背包看成S=INF,再跑多重背包(时间复杂度高,3层for循环): #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn]; int v[maxn],w[m 阅读全文
posted @ 2021-02-04 19:28 Anonytt 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 朴素版本: #include<bits/stdc++.h> using namespace std; const int maxn=1005; int dp[maxn][maxn]; int v[maxn][maxn],w[maxn][maxn],s[maxn]; int main(){ int n 阅读全文
posted @ 2021-02-03 20:46 Anonytt 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 朴素无优化版本: #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn][maxn]; int v[maxn],w[maxn],s[maxn]; int main(){ int n,m;scanf 阅读全文
posted @ 2021-02-03 19:14 Anonytt 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 暴力朴素无优化写法(3维for+2维数组): #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn][maxn]; int v[maxn],w[maxn]; int main(){ int n,m 阅读全文
posted @ 2021-02-03 18:14 Anonytt 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 以下介绍的两种降幂方法均适用于大指数快速幂乘法。 费马小定理降幂: 首先根据费马小定理,∵gcd(a,b)=1,∴ap-1 ≡ 1 (mod p) 举个例子引入:假设p=7,求232 % p = ? 由费马小定理可以知道:26 % p=1,∴((26)k)%p = 1,(k=1,2,3...n) 那 阅读全文
posted @ 2021-01-31 11:36 Anonytt 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 朴素2维无优化写法: #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn][maxn],v[maxn],w[maxn]; int main(){ int n,m;scanf("%d%d",&n, 阅读全文
posted @ 2021-01-28 20:53 Anonytt 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 通过:A.D.F.H.I.J A:Wrestling Match Editorial:用二分图来做,以好人坏人开始各做一次bfs,遇到冲突就直接结束,最后再把m组数据里没有vis过的跑bfs,最后再特判是否还有没有vis过的,如果还存在就输出NO #include<bits/stdc++.h> #p 阅读全文
posted @ 2021-01-27 20:50 Anonytt 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 考完雅思了开始康复训练...争取以后每把都打不咕。 A.Odd Divisor Editorial:偶数有个特性就是可以一直除2,所以我们只需要判断无限除2之后的奇数是不是1即可。 #include<bits/stdc++.h> #pragma GCC optimize(2) #define ll 阅读全文
posted @ 2021-01-26 12:19 Anonytt 阅读(175) 评论(0) 推荐(0) 编辑
摘要: E.zy与魔法石 tag:模拟,贪心 cf分值:1400 出题人前言:本来想着这个题大家推出规律就可以直接模拟AC的,因为数据范围给的挺舒适,本来定位是签到题级别的。但是现场只有Aklice一个人过,作为出题人还是觉得很不满意的,很多人是题读错了。 解法:推出规律其实发现,n大小的背包想尽可能多装不 阅读全文
posted @ 2020-12-20 20:05 Anonytt 阅读(78) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页