随笔分类 -  容斥

hdu6143 Killer Names 容斥+排列组合
摘要:/** 题目:hdu6143 Killer Names 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6143 题意:有m种字符(可以不用完),组成两个长度为n的字符串,要求这两个字符串含有的字符没有相同的。 求有多少种方式组成这两个字符串。 思路:容斥+排列组合 反思一开始以为这题是dp,然后想了很久没想出来,觉得挺不好处理的,,能力不足。 后来想到... 阅读全文

posted @ 2017-08-17 19:11 hnust_accqx 阅读(224) 评论(0) 推荐(0)

bzoj2005 能量采集 莫比乌斯或者普通容斥
摘要:/** 题目:bzoj2005 能量采集 链接:https://vjudge.net/contest/178455#problem/F 题意:栋栋有一块长方形的地,他在地上种了一种能量植物,这种植物可以采集太阳光的能量。在这些植物采集能量后, 栋栋再使用一个能量汇集机器把这些植物采集到的能量汇集到一起。 栋栋的植物种得非常整齐,一共有n列,每列 有m棵,植物的横竖间距都一样,因此对于每一棵植物... 阅读全文

posted @ 2017-08-15 10:19 hnust_accqx 阅读(152) 评论(0) 推荐(0)

Codeforces839D Winter is here 容斥
摘要:/** 题目:Codeforces839D Winter is here 链接:http://codeforces.com/contest/839/problem/D 题意:给定n个数,求所有的最大公约数>1的子集的贡献之和。 一个子集的贡献为最大公约数*子集大小 思路: cnt[i]表示约数为i的数的个数。 ans[i]表示约数为i的所有k的和。 已知ans[i]可以求得贡献为i*ans[i... 阅读全文

posted @ 2017-08-14 11:41 hnust_accqx 阅读(118) 评论(0) 推荐(0)

hdu6053 TrickGCD 容斥原理
摘要:/** 题目:hdu6053 TrickGCD 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6053 题意:You are given an array A , and Zhu wants to know there are how many different array B satisfy the following conditions? *... 阅读全文

posted @ 2017-08-14 09:35 hnust_accqx 阅读(129) 评论(0) 推荐(0)

hdu6059 Kanade's trio 字典树+容斥
摘要:转自:http://blog.csdn.net/dormousenone/article/details/76570172 /** 题目:hdu6059 Kanade's trio 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6059 题意:含 N 个数字的 A 数组,求有多少个三元组 (i,j,k) 满足 i #include #include #... 阅读全文

posted @ 2017-08-04 20:09 hnust_accqx 阅读(172) 评论(0) 推荐(0)

hdu1695 GCD2 容斥原理 求x属于[1,b]与y属于[1,d],gcd(x,y)=k的对数。(5,7)与(7,5)看作同一对。
摘要:GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10992 Accepted Submission(s): 4157 Problem Description Given 5 integers: a, b, c, d, ... 阅读全文

posted @ 2017-05-12 11:56 hnust_accqx 阅读(284) 评论(0) 推荐(0)

hdu2588 GCD 给定n,m。求x属于[1,n]。有多少个x满足gcd(x,n)>=m; 容斥或者欧拉函数
摘要:GCD Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2155 Accepted Submission(s): 1093 Problem Description The greatest common divisor GCD... 阅读全文

posted @ 2017-05-12 10:10 hnust_accqx 阅读(1269) 评论(0) 推荐(0)

导航