結果

問題 No.2384 Permutations of Permutations
ユーザー cologne
提出日時 2023-07-14 21:52:02
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 3,176 ms
コンパイル使用メモリ 248,128 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 06:47:49
合計ジャッジ時間 3,691 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;

using Mint = atcoder::modint998244353;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, K;
	cin >> N >> K;
	vector<Mint> F(N + 1);
	F[0] = 1;
	for (int i = 1; i <= N; i++)
		F[i] = i * F[i - 1];

	if (N == 4 || N == 5 || N > 6)
		cout << (F[N] / (F[N] / F[K] / F[N - K] * F[K - 1])).val() << endl;
	if (N == 3)
	{
		cout << 2 << endl;
	}
	if (N == 2)
	{
		cout << 1 << endl;
	}
	if (N == 6)
	{
		cout << (2 * F[N] / (F[N] / F[K] / F[N - K] * F[K - 1])).val() << endl;
	}
}
0