結果

問題 No.2384 Permutations of Permutations
ユーザー testestesttestestest
提出日時 2023-07-14 22:12:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 78,972 KB
最終ジャッジ日時 2023-10-14 12:25:57
合計ジャッジ時間 4,172 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,436 KB
testcase_01 AC 77 ms
71,100 KB
testcase_02 AC 75 ms
71,100 KB
testcase_03 AC 76 ms
71,060 KB
testcase_04 AC 76 ms
71,280 KB
testcase_05 AC 175 ms
78,972 KB
testcase_06 AC 175 ms
78,772 KB
testcase_07 AC 77 ms
71,284 KB
testcase_08 AC 76 ms
71,308 KB
testcase_09 AC 75 ms
71,416 KB
testcase_10 AC 75 ms
71,104 KB
testcase_11 WA -
testcase_12 AC 77 ms
71,140 KB
testcase_13 AC 75 ms
71,304 KB
testcase_14 WA -
testcase_15 AC 95 ms
75,956 KB
testcase_16 AC 94 ms
76,164 KB
testcase_17 AC 127 ms
76,672 KB
testcase_18 AC 92 ms
76,000 KB
testcase_19 AC 79 ms
75,196 KB
testcase_20 AC 78 ms
71,408 KB
testcase_21 AC 90 ms
76,076 KB
testcase_22 AC 77 ms
71,052 KB
testcase_23 AC 117 ms
76,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""
N=2,6以外で答えは(N-K)!*K
Aut(SN)の元は全て内部自己同型で、rotateと可換なのはrotateだけなので(?)。
N=2は自明
N=6はわからん。Autが2倍なのでとりあえず2を掛けてみる。外部自己同型の分でK=2,3,6のときはさらに増えるらしいのでとりあえず2倍 当たれ~~
"""

import math
N,K=map(int,input().split())
M=998244353
if N==2:
  print(1)
else:
  ans=math.factorial(N-K)*K%M
  if N==6:
    ans=ans*2%M
    if K in [2,3,6]:
      ans=ans*2%M
  print(ans)
0