Inclusion-Exclusion Principle
See the complete article on my own blog https://dyingdown.github.io/2019/08/15/Inclusion-Exclusion-Principle/
In combinatorics (combinatorial mathematics), the inclusion–exclusion principle is a counting technique which generalizes the familiar method of obtaining the number of elements in the union of two finite sets; – From Wikipedia
[外链图片转存失败(img-i1D8ihUF-1567835680066)(https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Inclusion-exclusion.svg/220px-Inclusion-exclusion.svg.png)]
Example: Set A and B
∣ A ∪ B ∣ = ∣ A ∣ + ∣ B ∣ − ∣ A ∩ B ∣ |A \cup B| = |A|+|B|-|A \cap B| ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣
Set A, B and C
∣ A ∪ B ∪ C ∣ = ∣ A ∣ + ∣ B ∣ + ∣ C ∣ − ∣ A ∩ B ∣ − ∣ A ∩ C ∣ − ∣ B ∩ C ∣ + ∣ A ∩ B ∩ C ∣ |A \cup B \cup C| = |A| + |B| + |C| -|A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C| ∣A∪B∪

本文介绍了组合数学中的包含排除原理,该原理用于计算有限集合的并集元素数量。文章提供了一个例子,解释了如何使用该原理来计算在特定范围内与给定数互质的整数的数量。给出了输入输出格式,并指出这是一个应用包含排除原理解决的问题。
最低0.47元/天 解锁文章
577

被折叠的 条评论
为什么被折叠?



