上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: const int N=100010; int n, a, b; vector<int> e[N];//用vector作邻接表 int siz[N], pos, ans=1e9; void dfs(int x, int fa){ siz[x]=1; int mx=0; for(auto y : e[ 阅读全文
posted @ 2023-12-05 19:52 potential-star 阅读(6) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P4316 本题暂时只写了用期望dp经典套路,套上期望DP的基本套路,设dp(u)为到达u点的期望长度。 期望dp,也叫概率dp 一般来说,期望dp找到正确的状态后,转移是比较容易想到的。 但一般情况下,状态一定是“可数”的 事实上, 阅读全文
posted @ 2023-12-05 00:56 potential-star 阅读(21) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/description/4012/ Acwing long double卡常,注意cin读小数。 #include <bits/stdc++.h> using namespace std; #define ll long 阅读全文
posted @ 2023-12-04 23:11 potential-star 阅读(13) 评论(0) 推荐(0) 编辑
摘要: void floyd() { for (int k = 1; k <= n; k ++ ) for (int i = 1; i <= n; i ++ ) for (int j = 1; j <= n; j ++ ) d[i][j] = min(d[i][j], d[i][k] + d[k][j]); 阅读全文
posted @ 2023-12-03 21:48 potential-star 阅读(5) 评论(0) 推荐(0) 编辑
摘要: struct DSU { vector<int> f, siz; DSU() {} DSU(int n) { init(n); } void init(int n) { f.resize(n); std::iota(f.begin(), f.end(), 0); siz.assign(n, 1); 阅读全文
posted @ 2023-12-03 21:01 potential-star 阅读(24) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/activity/content/competition/problem_list/3648/ B题收获: 1.利用题目告诉的结论:1e9范围质数之差小于300 2.一个数不被2-a的任何数整除 等价于他的最小质因子需要大于a c题:初步宏观思路:不难想 阅读全文
posted @ 2023-12-03 20:53 potential-star 阅读(8) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/4010/ http://118.190.20.162/view.page?gpid=T130 脑子一热抱着玩的心态试了一下三分,当然炸了,就当初认识三分了。 正解是考虑p的变化的影响,p变成p+1的时候,答案的值取决于 阅读全文
posted @ 2023-11-30 17:39 potential-star 阅读(15) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/5367/ 题目如果只需要输出最大值,我都没有问题。每次需要输出方案的时候,我似乎都需要先统计最大值,再重新扫描一遍找所有能够取得最大值的方案,然后在这些方案中找到最大值。最好的做法应该是在找最大值的过程中就维护题目要求方 阅读全文
posted @ 2023-11-30 12:41 potential-star 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 题意是这样的,给你一个串,只有 T 和 W。令 T=2,W=1,将其变成数字串。然后每次给一个k,问是否存在一个子段和为k 一筐题目: https://www.acwing.com/problem/content/description/4040/ 基础版本,只需要存在性并输出任意一组合法解 htt 阅读全文
posted @ 2023-11-28 23:16 potential-star 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 看到B官方题解写了一堆,而如果能注意到一些性质,几行就写完了 题意:给一个A,B构成的字符串,可以将“AB”翻转成"BA",问最多可以进行多少次翻转? 实际上在手动模拟以后发现,由于题目限制了每个位置只能翻转一次,所以情况简单了不少。 只要还没过最后一个B,那么最后一个B之前的所有A就会被反转。真正 阅读全文
posted @ 2023-11-28 22:01 potential-star 阅读(49) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
点击右上角即可分享
微信分享提示