题目
题解思路
高中的圆桌排序,早就忘光了。
N个人选择一半进行组合,C(n,n/2) 因为可以交换结果还要除以2,然后再乘上两边的圆桌排序数即可。
AC代码
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
struct bian
{
double w;
int z;
bool operator < (const bian &other) const
{
return w > other.w;
}
};
int read() {
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
return x*f;
}
long long ans = 1;
int n;
int main ()
{
ios::sync_with_stdio(false);
cin>>n;
long long t1 = 1 ;
long long t2 = 1;
for (int i = 1 ; i <= n/2-1; i++ )
{
t1*=i;
}
for (int i = n/2 + 1 ; i <= n ; i++ )
{
ans*=i;
}
ans = (ans * t1 )/(n);
cout<<ans<<"\n";
return 0 ;
}