sgu222 分类: sgu 2015-06-12 09:27 24人阅读 评论(0) 收藏
数学题,
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
int fact[20] = {1,1,2,6,24,120,720,5040,40320,362880,3628800};
int choice(int m, int n)
{
return fact[n]/(fact[m]*fact[n-m]);
}
long long pow2(int x)
{
return (long long)x*x;
}
int main()
{
int n, k;
#ifndef ONLINE_JUDGE
freopen("sgu222.in","r",stdin);
freopen("sgu222.out","w",stdout);
#endif
std::cin >> n >> k;
if(k > n) std::cout << 0 << std::endl;
else std::cout << pow2(choice(k,n))*fact[k];
#ifndef ONLINE_JUDGE
fclose(stdin);
fclose(stdout);
#endif
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。