結果

問題 No.2384 Permutations of Permutations
ユーザー 👑 colognecologne
提出日時 2023-07-14 21:56:47
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 2,721 ms
コンパイル使用メモリ 247,316 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-14 12:05:03
合計ジャッジ時間 3,666 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 3 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,352 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

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