結果

問題 No.1186 長方形の敷き詰め
ユーザー takakin
提出日時 2020-08-22 22:49:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 685 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 49,776 KB
最終ジャッジ日時 2024-10-15 12:24:59
合計ジャッジ時間 3,402 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
mod=998244353
if n>m or n==1:
	print(1)
else:
	A=[0]*m
	for i in range(m):
		if i<n-1:
			A[i]=1
		elif i==n-1:
			A[i]=2
		else:
			A[i]=A[i-1]+A[i-n]
			if A[i]>mod:
				A[i]%=mod
	print(A[-1])
0