题目链接:http://lightoj.com/volume_showproblem.php?problem=1005
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std; const int maxe = ;
const int maxn = ;
const int INF = 0x3f3f3f; float dp[maxn];
long long C[maxn][maxn];
long long A[maxn][maxn]; int main()
{
//freopen("E:\\acm\\input.txt","r",stdin);
int T;
cin>>T;
for(int i=;i<=;i++) C[i][] = ;
A[][] = ;
for(int i=;i<=;i++) A[i][i] = A[i-][i-]*i;
for(int n=;n<=;n++)
for(int k=;k<=n;k++){
C[n][k] = C[n][k-] * (n-k+)/k;
A[n][k] = C[n][k]*A[k][k];
} for(int t=;t<=T;t++){
int n,k;
cin>>n>>k;
printf("Case %d: ",t);
dp[] = ;
if(k > n ) printf("0\n");
else if(k == ) printf("1\n");
else{
cout<<A[n][k]*C[n][k]<<endl;
}
}
}