求助柿子

P3223 [HNOI2012] 排队

```Python 3 import sys import math ans=0 n,m=map(int,input().split()) def f(x): return math.factorial(x) def A(x,y): return f(x)//f(x-y) if(n+3>=m): ans+=A(n+3,m)*A(n+2,n+2) if(n+2>=m): ans-=2*A(n+2,m)*A(n+1,n+1) print(ans) ```
by 星辰风月 @ 2021-07-18 15:19:48


蛤蛤我一开始也是这样想的,但是你忘了两个老师之间可以插一个女生。
by Suzt_ilymtics @ 2021-07-24 17:48:19


@[Chen_怡](/user/230804) 哦我上面的表述好像有点模糊。 我想应该是存在这样一种方案你没有考虑: `男女师女男`
by Suzt_ilymtics @ 2021-10-26 22:12:14


@[Suzt_ilymtics](/user/230580) 确实,非常明白了/bx
by Durancer @ 2021-10-26 22:16:26


|