結果

問題 No.1885 Flat Permutation
ユーザー hir355hir355
提出日時 2022-03-25 21:50:51
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 75,936 KB
最終ジャッジ日時 2023-08-04 08:43:54
合計ジャッジ時間 6,108 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,076 KB
testcase_01 AC 74 ms
71,480 KB
testcase_02 AC 75 ms
71,152 KB
testcase_03 AC 77 ms
75,544 KB
testcase_04 AC 75 ms
71,036 KB
testcase_05 AC 74 ms
70,892 KB
testcase_06 AC 74 ms
71,028 KB
testcase_07 AC 73 ms
71,304 KB
testcase_08 AC 75 ms
71,240 KB
testcase_09 AC 74 ms
71,044 KB
testcase_10 AC 73 ms
71,148 KB
testcase_11 AC 74 ms
71,348 KB
testcase_12 AC 74 ms
71,300 KB
testcase_13 AC 74 ms
71,252 KB
testcase_14 AC 74 ms
71,156 KB
testcase_15 AC 77 ms
71,348 KB
testcase_16 AC 78 ms
71,124 KB
testcase_17 AC 76 ms
71,092 KB
testcase_18 AC 77 ms
71,236 KB
testcase_19 AC 79 ms
75,736 KB
testcase_20 AC 79 ms
75,812 KB
testcase_21 AC 82 ms
75,928 KB
testcase_22 AC 84 ms
75,708 KB
testcase_23 AC 78 ms
71,280 KB
testcase_24 AC 75 ms
70,892 KB
testcase_25 AC 74 ms
71,292 KB
testcase_26 AC 74 ms
71,336 KB
testcase_27 AC 83 ms
75,936 KB
testcase_28 AC 80 ms
75,936 KB
testcase_29 AC 79 ms
75,840 KB
testcase_30 AC 80 ms
75,860 KB
testcase_31 AC 80 ms
75,652 KB
testcase_32 AC 75 ms
71,360 KB
testcase_33 AC 73 ms
71,080 KB
testcase_34 AC 73 ms
71,384 KB
testcase_35 AC 79 ms
75,704 KB
testcase_36 AC 78 ms
75,780 KB
testcase_37 AC 74 ms
71,032 KB
testcase_38 AC 73 ms
71,476 KB
testcase_39 AC 75 ms
71,092 KB
testcase_40 AC 77 ms
75,764 KB
testcase_41 AC 78 ms
75,744 KB
testcase_42 AC 76 ms
75,576 KB
testcase_43 AC 79 ms
75,700 KB
testcase_44 AC 87 ms
75,856 KB
testcase_45 AC 84 ms
75,784 KB
testcase_46 AC 76 ms
75,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
m, x, y = map(int, input().split())
n = abs(y - x) - 1
if x == 1 or x == m:
    n += 1
if y == 1 or y == m:
    n += 1
if n == 0:
    print(0)
else:
    a, b, c = 1, 1, 1
    for i in range(n - 2):
        a, b, c = b, c, a + c
        a %= MOD
        b %= MOD
        c %= MOD
    print(b)
0