
容斥定理
sdnuzsj
......
展开
-
容斥定理相关题目讲解
一. 由0到9的数字组成排列,要求第一个数大于1,最后一个数小于8,一共有多少种排列? 我们可以来计算它的逆问题,即第一个元素或者最后一个元素>=8的情况。 我们设第一个元素时有X组排列,最后一个元素>=8时有Y组排列。那么通过容斥原理来解决就可以写成: 即: 二. 长度为n的由数字0,1,2组成的序列,要求每个数字至少出现1次,这样的序列有多少原创 2017-10-13 18:20:03 · 613 阅读 · 0 评论 -
hdu5514--frogs
Problem Description There are m stones lying on a circle, and n frogs are jumping over them. The stones are numbered from 0 to m−1 and the frogs are numbered from 1 to n. The i-th frog原创 2017-10-18 20:52:30 · 316 阅读 · 0 评论