摘要:
判断是否为树森林不是树空树也是树成环不是树数据: 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 1 0 0 1 2 2 3 4 5 0 0 2 5 0 0ans:nonoyes#include #include #include #include #include #inclu... 阅读全文
摘要:
最小树形图大神博客#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;typedef long ... 阅读全文
摘要:
题解地址:点击打开链接题解:最终的结果一定是连续出现的,只需要求出最终的区间。因为如果对同一张牌进行两次操作,牌的状态不改变。故牌的翻转次数一定是减少偶数次。如果所有数的和是奇数,那么最终结果也一定是奇数。同理,偶数也是一样的。所以只要递推求出最后的区间,计算sum(C(xi,m)(i=0,1,2。... 阅读全文
摘要:
费马小定理:假如p是质数,且(a,p)=1,那么 a^(p-1) ≡1(mod p)。即:假如a是整数,p是质数,且a,p互质,那么a的(p-1)次方除以p的余数恒等于1。求1-n中每个数的正因子和: for(LL i=1;i ak-1 ,而 bk= ak + k > ak-1 + k-1 = ... 阅读全文