Codeforces Round #745 (Div. 2)

A题

CQXYM Count Permutations
当时知道是阶乘/2,但是数据都溢出了,边算边模又答案不对,就放弃了

// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const int N = 2e8 + 10;
const int M = 2e6 + 1000;
const int inf = 1000000000000007;
const int mod = 1000000007;
const int pi = acos(-1);
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
ll T, n, m, tot, res;
// ll fac[N];数组过大还REcao
int main()
{
    // IOS;
    scanf("%lld", &T);
    while (T--)
    {
        scanf("%lld", &n);
        m = 2 * n, res = 1;
        for (int i = 3; i <= m; i++) //从3开始避免除2
            res = res * i % mod;     //边乘边模是对的
        printf("%lld\n", res);
        // fac[0] = 1, fac[1] = 1, fac[2] = 2;
        // for (int i = 3; i <= m; i++) //这样不知道为啥过不了,答案不对
        //     fac[i] = fac[i - 1] * i % mod;
        // printf("%lld\n", fac[m] / 2 % mod);
    }
    return 0;
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WTcrazy _

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值