摘要: 昆明2022ICPC-C题 题目 https://ac.nowcoder.com/acm/contest/32708/C 考虑期望, \[ \begin{align*} Ans=&P(n=1)\times 1+P(n=2)\times 2+P(n=3)\times 3+\cdots\\ =&(P(n 阅读全文
posted @ 2022-04-21 22:29 zx0710 阅读(266) 评论(0) 推荐(2) 编辑
摘要: C. Basic Diplomacy 网络流 /* https://codeforces.ml/contest/1484/problem/C C. Basic Diplomacy */ #include<bits/stdc++.h> int T,n,m,s,t,temp,u,v; #define S 阅读全文
posted @ 2021-03-28 11:55 zx0710 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Winter Petrozavodsk Camp(7题) 2020-2021 Winter Petrozavodsk Camp, Belarusian SU Contest (XXI Open Cup, Grand Prix of Belarus) C. Brave Seekers of Unico 阅读全文
posted @ 2021-03-03 18:04 zx0710 阅读(560) 评论(1) 推荐(0) 编辑
摘要: labeled tree的个数 前置知识: oi-wiki矩阵树定理一 结论: $n$个不同的点可以构成$n^$棵不同的树(labeled tree). 推导过程: 完全图的Laplace矩阵带入定理一 无向完全图的邻接矩阵(n*n): \[ \begin{matrix} 0&1 &\cdots & 阅读全文
posted @ 2021-03-03 16:03 zx0710 阅读(257) 评论(0) 推荐(0) 编辑
摘要: F. New Year's Puzzle /* 短代码模拟就是我的人生理想 很妙的奇偶性:如果两个黑块的奇偶性不同 比如正好一上一下,这两个可以当成一组,也就意味着前面必然可以填满 */ #include<bits/stdc++.h> using namespace std; typedef lon 阅读全文
posted @ 2021-03-02 19:52 zx0710 阅读(52) 评论(0) 推荐(0) 编辑
摘要: P1372 又是一年毕业季 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int mod=998244353; ll n,k; #define debug(x) cout<<#x<<':'<<x<<e 阅读全文
posted @ 2021-02-08 23:07 zx0710 阅读(36) 评论(0) 推荐(0) 编辑
摘要: hdu1852 Beijing2008 非常好的题目,题解见注释。 #include<bits/stdc++.h> using namespace std; typedef long long ll; ll n,k; #define debug(x) cout<<#x<<':'<<x<<endl; 阅读全文
posted @ 2021-02-08 23:05 zx0710 阅读(22) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #680 (Div. 1) Codeforces Round #680 (Div. 1, based on Moscow Team Olympiad) A.(思维+质因分解) 题解见注释 /* O(n)求1-n逆元:前提:p是素数 inv[i]=(p-p/i)*in 阅读全文
posted @ 2021-02-08 21:35 zx0710 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 2021.2 月赛补题A-C 我一直觉得EOJ的题解写的可以,所以思路和题解基本参考Eoj官方题解。 连接:https://acm.ecnu.edu.cn/blog/entry/1089/ 这场真不愧是oi爷出题,我还没摸键盘,只是在地铁上看了看A,知道是个lca,没有想出来dfs序,就开始自闭了。 阅读全文
posted @ 2021-02-07 22:41 zx0710 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 链式前向星+Poj3321 参考博客:https://blog.csdn.net/acdreamers/article/details/16902023 /* 其中edge[i].to表示第i条边的终点,edge[i].next表示与第i条边同起点的下一条边的存储位置,edge[i].w为边权值. 阅读全文
posted @ 2021-02-06 22:15 zx0710 阅读(45) 评论(0) 推荐(0) 编辑