![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
容斥原理
qq_37383726
这个作者很懒,什么都没留下…
展开
-
qwb与支教 【容斥】+【二分枚举】
Description qwb同时也是是之江学院的志愿者,暑期要前往周边地区支教,为了提高小学生的数学水平。她把小学生排成一排,从左至右从1开始依次往上报数。玩完一轮后,他发现这个游戏太简单了。于是他选了3个不同的数x,y,z;从1依次往上开始报数,遇到x的倍数、y的倍数或z的倍数就跳过。如果x=2,y=3,z=5;第一名小学生报1,第2名得跳过2、3、4、5、6,报7;第3名得跳过8、9、10,原创 2017-06-03 09:26:58 · 364 阅读 · 0 评论 -
【HDU 6397】Character Encoding 【生成函数公式推导】
In computer science, a character is a letter, a digit, a punctuation mark or some other similar symbol. Since computers can only process numbers, number codes are used to represent characters, which i...原创 2018-08-21 21:52:41 · 242 阅读 · 0 评论 -
【牛客练习赛8】A D E
A 约数个数的和 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 给个n,求1到n的所有数的约数个数的和~ 输入描述: 第一行一个正整数n 输出描述: 输出一个整数,表示答案 示例1 输入3 输出5 说明样例解释: 1有1个约数1 2有2个约数1,2 3有2个原创 2017-12-16 19:35:54 · 598 阅读 · 0 评论 -
HPUOJ WitchMirror 【容斥】or 【状态压缩+容斥】
王炸的队友地雷(你可以叫他雷雷)要考科一了,但地雷总是不太自信,因为他看的题太少了。王炸为了帮他,就拿出来了一面魔镜,这个魔镜可以告诉雷雷他还不会的题有多少。但是魔镜自诩是hpu毕业的高材生,并不想直接了当的告诉地雷,他通过以下这种方式让地雷自己计算出来:魔镜给地雷m个数字(a1、a2 …… am)和一个整数n,魔镜定义:如果有一个数,是这m个数字里面任意一个数的倍数,那么这个数称为LuckyNum原创 2017-07-20 18:24:57 · 221 阅读 · 0 评论 -
【Gym - 101350G】Snake Rana 【状态压缩 +容斥定理】
Old Macdonald wants to build a new hen house for his hens. He buys a new rectangular area of size N by M. The night before he builds the hen house, snake Rana devises an evil plan to plant bombs in K d原创 2017-11-03 23:01:25 · 272 阅读 · 0 评论 -
【hdu 1695 】GCD 【容斥+欧拉 or mobius反演】
Given 5 integers: a, b, c, d, k, you’re to find x in a…b, y in c…d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be very large, you’re only原创 2017-08-01 21:13:49 · 337 阅读 · 0 评论 -
【ZZULIOJ 1302】海军节上的鸣炮声计算 【容斥】
海军节上的鸣炮声计算 Description在海军节开幕式上,有A、B、C三艘军舰要同时开始鸣放礼炮各n响。已知A舰每个a秒放一次,B舰每隔b秒放一次,C舰每隔c秒放一次。假设各炮手对时间的掌握非常准确,请编程计算观众总共可以听到几次炮声。Input输入n,a,b,c的值,所有输入不大于10000。Output输出一个整数,代表观众听到的礼炮声总数。Sample Input21 7 6 5 Sa原创 2017-08-06 20:31:47 · 1534 阅读 · 0 评论 -
【 hdu 6053】 TrickGCD 【数论 容斥 + 莫比乌斯函数 】
Problem Description You are given an array A , and Zhu wants to know there are how many different array B satisfy the following conditions? 1≤Bi≤Ai For each pair( l , r ) (1≤l≤r≤n) , gcd(bl,bl+1…br)≥2原创 2017-08-07 10:18:44 · 255 阅读 · 0 评论 -
【 hdoj 1796】How many integers can you find 【容斥】
Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and M-integer se原创 2017-08-01 15:56:59 · 184 阅读 · 0 评论 -
2 3 5 7的倍数 【容斥】
给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如N = 10,只有1不是2 3 5 7的倍数。 Input 输入1个数N(1 <= N <= 10^18)。 Output 输出不是2 3 5 7的倍数的数共有多少。 Sample Input 10 Sample Output 1 代码 知识点方面可以看下这道题目所以 ,因为给的四个数是互质的所以 ,他们的lcm原创 2017-07-20 12:28:54 · 505 阅读 · 0 评论 -
Visible Trees 【容斥】
There are many trees forming a m * n grid, the grid starts from (1,1). Farmer Sherlock is standing at (0,0) point. He wonders how many trees he can see. If two trees and Sherlock are in one line, Farme原创 2017-07-20 12:10:38 · 359 阅读 · 0 评论 -
Co-prime 【容斥】
Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N. Two integers are said to be co-prime or relatively prime if they have no com原创 2017-07-20 10:31:55 · 207 阅读 · 0 评论 -
[UVALive - 7040]Color [容斥 恰好k个]
题意: 用m种颜色染一个线性格子,相邻格子颜色不同,问恰好染k种颜色的方案数. 至多用k个颜色的方案数目为 k∗(k−1)k * (k - 1)k∗(k−1) 但是要求的是恰好k个颜色,考虑容斥 AiA_iAi 表示不用i号颜色i号颜色i号颜色 然后考虑对立面, ∣A1‾∩A2‾∩...∩Ak‾∣=| \overline{A_1} \cap \overline{A_2} \cap...\cap...原创 2018-10-19 22:23:22 · 253 阅读 · 0 评论