![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
容斥定理
等我学会后缀自动机
侠影之谜
展开
-
HDU 1695 GCD (容斥定理+数论性质)*
GCDTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15656 Accepted Submission(s): 6024 Problem DescriptionGiven 5 integers: a, b, c, d...原创 2018-08-18 10:19:00 · 125 阅读 · 0 评论 -
HDU 5514 Frogs (另类的容斥+思维)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5514#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(...原创 2018-09-07 07:23:22 · 118 阅读 · 0 评论 -
HDU 5213 Lucky (莫队算法+容斥定理)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5213#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,...原创 2018-09-18 08:11:59 · 185 阅读 · 0 评论 -
HDU 6102 GCDispower (花样容斥+DP思维+树状数组维护)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6102#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-10-25 20:25:37 · 156 阅读 · 0 评论 -
UVA 11481 Arrange the Numbers (简单容斥)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l...原创 2018-10-31 11:52:56 · 124 阅读 · 0 评论 -
UVA 10542 Hyper-drive (容斥定理+规律)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1483#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-10-27 15:25:45 · 134 阅读 · 0 评论 -
HDU 6415 K-Multiple Free set (容斥定理)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2203#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-10-30 15:41:51 · 148 阅读 · 0 评论 -
Codeforces 439E Devu and Birthday Celebration (容斥定理+组合)
题目链接:http://codeforces.com/problemset/problem/439/E#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2018-10-30 20:24:46 · 185 阅读 · 0 评论 -
HDU 6363 bookshelf (莫比乌斯反演+组合+斐波那契性质)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6363#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2018-11-07 22:40:08 · 177 阅读 · 0 评论 -
Code forces 93E Lostborn (dp+递归)*
题目链接:http://codeforces.com/problemset/problem/93/E#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long...原创 2018-11-12 17:19:59 · 191 阅读 · 0 评论 -
CodeForces 451E Devu and Flowers (容斥+组合)
题目链接:http://codeforces.com/problemset/problem/451/E#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2019-02-10 00:06:04 · 164 阅读 · 0 评论 -
Codeforces Round #539 (Div. 2) C. Sasha and a Bit of Relax(数学+异或性质)
题目链接:http://codeforces.com/contest/1113/problem/C题目大意:给定一个整数序列,问有多少个二元组(l,r),满足l到r的数异或起来为0的。题目分析: 异或的技巧吧,不难发现如果(l,r)满足条件,那么S[l-1]=S[r],其中S是异或前缀和,下面就是个简单的计数啦,可以看到偶数下标之间相减为偶数,奇数下标之间相减为奇数,...原创 2019-02-18 17:44:49 · 96 阅读 · 0 评论 -
CodeForces 611C New Year and Domino (DP+组合容斥)
题目链接:http://codeforces.com/problemset/problem/611/C题目大意给定一个二维字符矩阵,和若干个查询,每次查询问子矩阵中可以有多少种1x2或是2x1矩阵的摆放方式题目分析 先考虑DP转移方程,DP[i][j]表示(1,1),(i,j)矩阵中可以有多少种摆放方式,状态转移:DP[i][j]=DP[i-1][j]+DP[i][j-1...原创 2019-02-25 22:51:23 · 167 阅读 · 0 评论 -
CodeForces 630K Indivisibility (容斥)
题目链接:http://codeforces.com/problemset/problem/630/K题目大意略题目分析 把2到10的所有出现的质数都找出来,对这个集合进行容斥即可。因为其区间是连续的所以可以这么做,直接暴力容斥的话取的是公倍数关系。#include<bits/stdc++.h>using namespace std;#defi...原创 2019-02-25 22:56:55 · 265 阅读 · 0 评论 -
沈阳网络赛 C Convex Hull (莫比乌斯反演+推公式+快速乘)*
题目链接:https://nanti.jisuanke.com/t/31444#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z) for(i...原创 2018-09-09 08:38:16 · 484 阅读 · 0 评论 -
HDU 6134 Battlestation Operational (莫比乌斯反演+积性函数筛)*
Battlestation OperationalTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 752 Accepted Submission(s): 420 Problem Description> The ...原创 2018-09-03 23:08:10 · 162 阅读 · 0 评论 -
HDU 2204 Eddy's爱好 (容斥原理)
Eddy's爱好Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3031 Accepted Submission(s): 1491 Problem DescriptionIgnatius 喜欢收集蝴蝶标本和邮票,但是E...原创 2018-08-18 13:53:27 · 430 阅读 · 0 评论 -
HDU 6397 Character Encoding(容斥定理)
Character EncodingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 949 Accepted Submission(s): 361 Problem DescriptionIn computer sc...原创 2018-08-16 15:04:08 · 267 阅读 · 0 评论 -
HDU 4407 Sum (容斥定理+DFS搜索)
SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4278 Accepted Submission(s): 1227 Problem DescriptionXXX is puzzled with the quest...原创 2018-08-19 11:58:41 · 167 阅读 · 0 评论 -
HDU 6390 GuGuFishtion(莫比乌斯函数+积性函数)
GuGuFishtion Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1403 Accepted Submission(s): 543 Problem Description Today...原创 2018-08-22 21:15:48 · 197 阅读 · 0 评论 -
UVA 11806 Cheerleaders(容斥定理)
In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of play. The world cup soccer is no ex...原创 2018-08-17 07:33:39 · 173 阅读 · 0 评论 -
UVA 10325 The Lottery (容斥原理)
The Sports Association of Bangladesh is in great problem with their latest lottery ‘Jodi laiga Jai’. There are so many participants this time that they cannot manage all the numbers. In an urgent meet...原创 2018-08-17 08:08:09 · 207 阅读 · 0 评论 -
HDU 1796 How many integers can you find (容斥原理)
How many integers can you findTime Limit: 12000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10897 Accepted Submission(s): 3243 Problem Description...原创 2018-08-17 11:13:20 · 79 阅读 · 0 评论 -
HDU 4790 Just Random (概率 + 容斥思想+数学)
Just RandomTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3415 Accepted Submission(s): 1103 Problem Description Coach Pang and Uncl...原创 2018-08-27 23:26:53 · 130 阅读 · 0 评论 -
HDU 5514 Frogs (容斥思想+数论知识)*
Frogs Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 4142 Accepted Submission(s): 1396 Problem Description There are ...原创 2018-08-25 08:04:35 · 149 阅读 · 0 评论 -
HDU 5101 Select (二分+容斥水过)
SelectTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2331 Accepted Submission(s): 663 Problem DescriptionOne day, Dudu, the most cle...原创 2018-09-02 21:34:47 · 104 阅读 · 0 评论 -
沈阳网络赛 G Spare Tire (DFS容斥+推公式)
题目链接:https://nanti.jisuanke.com/t/31448#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z) for(i...原创 2018-09-08 19:40:12 · 310 阅读 · 0 评论 -
HDU 5297 Y Sequence (容斥定理+迭代法搜索答案)*
Y sequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2559 Accepted Submission(s): 633 Problem DescriptionYellowstar likes intege...原创 2018-09-05 17:15:58 · 134 阅读 · 0 评论 -
HDU 5468 Puzzled Elena (树形集合的容斥+DFS序+区间性质)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5468#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(...原创 2018-09-12 00:22:10 · 106 阅读 · 0 评论 -
HDU 6513 Reverse It(组合数学+消去重复度)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6513题目大意给定一个01矩阵,现在可以选择至多两个子矩阵把值进行转换(0-1,1-0),问能产生总共多少种不同的花纹数.题目分析首先考虑两个子矩阵和一个子矩阵,不难发现一个子矩阵就是:C(n+1,2)*C(m+1,2),因为n个长度其格点有n+1个.而两个子...原创 2019-05-01 23:09:23 · 255 阅读 · 0 评论