1581A - CQXYM Count Permutations - CodeForces Solution


combinatorics math number theory *800

Please click on ads to support us..

Python Code:

t = int(input())
for i in range(t):
    n = int(input())
    ans = 1
    for i in range(3, 2*n+1):
        ans *= i
        ans %= 1000000007
    ans %= 1000000007
    print(ans)

C++ Code:

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9 + 7;
signed main () {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        int l = 1;
        for (int i = 2 * n; i > 2; i--) {
            l = (l * i) % MOD;
        }
        cout << l << '\n';
    }
}


Comments

Submit
0 Comments
More Questions

810A - Straight A
1433C - Dominant Piranha
633A - Ebony and Ivory
1196A - Three Piles of Candies
299A - Ksusha and Array
448B - Suffix Structures
1092B - Teams Forming
1166C - A Tale of Two Lands
544B - Sea and Islands
152B - Steps
1174D - Ehab and the Expected XOR Problem
1511A - Review Site
1316A - Grade Allocation
838A - Binary Blocks
1515D - Phoenix and Socks
1624D - Palindromes Coloring
1552F - Telepanting
1692G - 2Sort
1191A - Tokitsukaze and Enhancement
903A - Hungry Student Problem
52B - Right Triangles
1712A - Wonderful Permutation
1712D - Empty Graph
1712B - Woeful Permutation
1712C - Sort Zero
1028B - Unnatural Conditions
735B - Urbanization
746C - Tram
1278B - A and B
1353D - Constructing the Array