Skip to content

Commit 72c81db

Browse files
authored
Merge pull request cp-algorithms#688 from rajatdiptabiswas/patch-3
Fix typo
2 parents 34fb614 + 369c2e3 commit 72c81db

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/combinatorics/inclusion-exclusion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Notice first that we can easily count the number of strings that satisfy at once
229229
230230
Learn now to solve the first version of the problem: when the string must satisfy exactly $k$ of the patterns.
231231
232-
To solve it, iterate and fix a specific subset $X$ from the set of patterns consisting of $k$ patterns. Then we have to count the number of strings that satisfy this set of patterns, and only matches it, that is, they don't match any other pattern. We will use the inclusion-exclusion principle in a slightly different manner: we sum on all supersets $Y$ (subsets from the original set of strings that contain $X$), and either add to the current answer of subtract it from the number of strings:
232+
To solve it, iterate and fix a specific subset $X$ from the set of patterns consisting of $k$ patterns. Then we have to count the number of strings that satisfy this set of patterns, and only matches it, that is, they don't match any other pattern. We will use the inclusion-exclusion principle in a slightly different manner: we sum on all supersets $Y$ (subsets from the original set of strings that contain $X$), and either add to the current answer or subtract it from the number of strings:
233233
234234
$$ ans(X) = \sum_{Y \supseteq X} (-1)^{|Y|-k} \cdot f(Y) $$
235235

0 commit comments

Comments
 (0)