@inkysakura
2017-04-24T23:00:19.000000Z
字数 339
阅读 1277
CODE
#include <iostream>
using namespace std;
long long c(long long n,long long k)
{
long long res = 1;
for(int i=1;i<=k;i++)
{
res*=n-i+1;
res/=i;
}
return res;
}
long long f[35];
int t,n,k;
int main()
{
f[0]=1;
for(int i=1;i<32;i++)
{
f[i]=f[i-1]*i;
}
cin >> t;
for(int nCase =1;nCase <=t;nCase++)
{
cout << "Case "<<nCase<<": ";
cin >> n >> k;
cout << c(n,k)*c(n,k)*f[k]<<endl;
}
return 0;
}