随笔分类 - ACM_容斥原理
摘要:题目链接 题意:有n只青蛙,m个石头(围成圆圈)。第i只青蛙每次只能条ai个石头,问最后所有青蛙跳过的石头的下标总和是多少? 题解:暴力肯定会超时,首先分解出m的因子,自己本身不用分,因为石头编号是0到m-1,第i只青蛙只能走到gcd(ai, m)的位置,我们就可以把m的因子提取出来,然后对青蛙能走
阅读全文
摘要:题目:传送门。 题意:t组数据,每组给定n,m,k。有n个格子,m种颜色,要求把每个格子涂上颜色且正好适用k种颜色且相邻的格子颜色不同,求一共有多少种方案,结果对1e9+7取余。 题解: 首先可以将m 与后面的讨论分离。从m 种颜色中取出k 种颜色涂色,取色部分有C(m, k) 种情况; 然后通过尝
阅读全文
摘要://求一个集合的子集 #include using namespace std; int main() { int n=4; int a[4]={15,20,25,30}; for(int i=0;i<(1<<n);i++) { printf("%d: ",i); for(int j=0;j<n;j++) {...
阅读全文
摘要:G - Coprime Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 5072 G - Coprime Submit Status Practice H
阅读全文
摘要:E - The Boss on Mars Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4059 E - The Boss on Mars Submit
阅读全文
摘要:B - Sky Code Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3904 B - Sky Code Submit Status Practice
阅读全文
摘要:The Sports Association of Bangladesh is in great problem with their latest lottery `Jodi laiga Jai'. Thereare so many participants this time that they
阅读全文
摘要:H - Visible Trees Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2841 H - Visible Trees Submit Status
阅读全文
摘要:In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Theirroles are substantial during breaks and prio
阅读全文
摘要:F - GCD Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1695 F - GCD Submit Status Practice HDU 1695 D
阅读全文

浙公网安备 33010602011771号