Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Marin and Anti-coprime Permutation codeforces solution in c++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#define ll long long
using namespace std;
 
void solve()
{
	//B. Marin and Anti-coprime Permutation
 
	ll n;
	cin >> n;
	if (n % 2 ==1)
	{
		cout << 0 << "
";
	}
	else
	{
		ll sum = 1;
		for (int i = 1; i <= n / 2; i++)
		{
			sum = (i * sum) % 998244353;
			
		}
		
		sum *= sum;
		
		cout << sum % 998244353 << "
";
	}
}
 
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Marin #Permutation #codeforces #solution
ADD COMMENT
Topic
Name
1+9 =