結果

問題 No.1885 Flat Permutation
ユーザー shobonvip
提出日時 2022-03-25 23:57:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,472 KB
実行使用メモリ 73,728 KB
最終ジャッジ日時 2024-10-14 08:15:23
合計ジャッジ時間 3,661 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x, y = map(int,input().split())
if x > y:
	x, y = y, x

t = x + 1
if x == 1:
	t = 1

u = y - 1
if y == n:
	u = y

mod = 998244353

if t > u:
	print(0)
else:
	targ = u - t
	a = [0, 1, 1]
	for i in range(targ):
		a.append((a[-1] + a[-3]) % mod)
	print(a[targ+1])
0