Codeforces Round 677 (Div. 3) E. Two Round Dances(数论)

发布时间 2023-04-10 19:47:27作者: 高尔赛凡尔娟

https://codeforces.com/contest/1433/problem/E

题目大意:

n个人(n是偶数)跳了两轮舞,每轮舞正好有n/2个人。你的任务是找出n个人跳两轮舞的方法,如果每轮舞正好由n/2个人组成。每个人都应该属于这两种圆舞中的一种。

人相同位置不同也算是同一种方案。
input 
2
output 
1
input 
4
output 
3
input 
8
output 
1260
input 
20
output 
12164510040883200

1300的题目,vp是一脸懵逼:这题这么好做吗?
好吧,vp结束后发现是排列组合。(文科生不懂系列

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL MAXN=1e18,MINN=-MAXN,INF=0x3f3f3f3f;
const LL N=1e6+10,M=2023;
const LL mod=100000007;
const double PI=3.1415926535;
#define endl '\n'
LL a[N];
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL n;
        cin>>n;
        LL sum=1;
        for(LL i=1;i<=n;i++)
        {
            sum=sum*i;
        }
        sum*=2;
        sum/=(n*n);
        cout<<sum<<endl;
    }
    return 0;
}