結果

問題 No.2384 Permutations of Permutations
ユーザー cologne
提出日時 2023-07-14 21:56:47
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 2,547 ms
コンパイル使用メモリ 247,708 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-16 06:55:02
合計ジャッジ時間 3,269 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 == 2)
	{
		cout << 1 << endl;
	}
	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)
	{
		if (K == 2)
			cout << 2 << endl;
		if (K == 3)
			cout << 3 << endl;
	}
	if (N == 6)
	{
		cout << ( F[N] / (F[N] / F[K] / F[N - K] * F[K - 1])).val() << endl;
	}
}
0