数论
朝歌夜弦,为秦宫人
这个作者很懒,什么都没留下…
展开
-
51 nod 1253 Kundu and Tree
树包含N个点和N-1条边。树的边有2中颜色红色(‘r’)和黑色(‘b’)。给出这N-1条边的颜色,求有多少节点的三元组(a,b,c)满足:节点a到节点b、节点b到节点c、节点c到节点a的路径上,每条路径都至少有一条边是红色的。 注意(a,b,c), (b,a,c)以及所有其他排列被认为是相同的三元组。输出结果对1000000007取余的结果。 找补集,快乐容斥一下就好了 #include<...原创 2019-10-24 08:55:02 · 95 阅读 · 0 评论 -
MOBIUS
题目描述 Description Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only one problem – Petru has locked the spacec原创 2019-05-24 09:57:29 · 228 阅读 · 0 评论 -
线性筛素数
#include<bits/stdc++.h> #define re return #define inc(i,l,r) for(register int i=l;i<=r;++i) using namespace std; char buf[1<<21],*p1,*p2; inline int gc(){re p1==p2 and(p2=(p1=buf)+f...原创 2019-06-11 11:13:06 · 338 阅读 · 0 评论