容斥原理
wwt9b15bs
这个作者很懒,什么都没留下…
展开
-
【题解】codeforces451E Devu and Flowers 容斥原理+组合计数
DescriptionDevu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hence they are indis...原创 2018-09-13 06:52:50 · 403 阅读 · 0 评论 -
【题解】[牛客网NOIP赛前集训营-提高组(第二场)]B.分糖果 单调栈优化线性DP+容斥原理
题目链接#include<cstdio>#define re registertypedef long long ll;const int N=1e6+10;const int INF=0x3f3f3f3f;const int mod=1e9+7;template<typename tp>inline int getmin(tp&x,tp...原创 2018-10-30 09:30:54 · 1341 阅读 · 0 评论 -
【题解】[牛客OI周赛4-提高组]B.最后的晚餐 组合数+容斥原理
题目链接#include<cstdio>typedef long long ll;const int mod=1e9+7;int n;ll ans=1,a,b,c;int main(){ scanf("%d",&n); if(n==1){puts("0");return 0;} a=1;b=n-2; for(int i=...原创 2018-11-01 17:51:12 · 361 阅读 · 0 评论