阅读背景:

状压汇总

来源:互联网 

SGU 222:

很明显答案是\(C_n^k*A_n^k\)

Code
#define B cout << "BreakPoint" << endl;
#define O(x) cout << #x << " " << x << endl;
#define O_(x) cout << #x << " " << x << " ";
#define Msz(x) cout << "Sizeof " << #x << " " << sizeof(x)/1024/1024 << " MB" << endl;
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<set>
#define LL long long
const int inf = 1e9 + 9;
const int N = 2e5 + 5;
using namespace std;
inline int read() {
	int s = 0,w = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9') {
		if(ch == '-')
			w = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * w;
}
int n,k;
LL ans[N];
void pre(){
    ans[1] = 1,ans[0] = 1;
    for(int i = 2;i < 20;i++) ans[i] = ans[i - 1] * i;
}
void init(){
	n = read(),k = read();
    if(n < k) printf("0\n");
    else printf("%lld\n",ans[k] * (ans[n] / ans[k] / ans[n - k]) * (ans[n] / ans[k] / ans[n - k]));
}
int main(){
    pre();
    init();
}
#def



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: