标签:ott inf show tom ace 输出 ret ali 有一个
1 #include<bits/stdc++.h> 2 using namespace std; 3 long long int c,m,n,cuopai[25]; 4 long long int C(int n,int m){ 5 if(m == n || m == 0) 6 return 1; 7 else if(m == 1) 8 return n; 9 else 10 return C(n - 1,m - 1) + C(n - 1,m); 11 } 12 void init(){ 13 cuopai[1] = 0,cuopai[2] = 1; 14 for(int i = 3;i <= 20;i++) 15 cuopai[i] = (i - 1) * (cuopai[i - 2] + cuopai[i - 1]); 16 return; 17 } 18 int main(){ 19 init();//错排打表 20 scanf("%lld",&c); 21 while(c--){ 22 scanf("%lld%lld",&n,&m); 23 printf("%lld\n",C(n,m) * cuopai[m]); 24 } 25 return 0; 26 }
标签:ott inf show tom ace 输出 ret ali 有一个
原文地址:https://www.cnblogs.com/Luckykid/p/9742065.html