結果

問題 No.1186 長方形の敷き詰め
ユーザー NatsubiSogan
提出日時 2020-07-31 21:10:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 410 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 54,044 KB
最終ジャッジ日時 2024-07-06 16:01:27
合計ジャッジ時間 5,299 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
if (not 1 <= n <= 10 ** 9) or (not 1 <= m <= 10 ** 6):
    exit(print(1 % 0))
mod = 998244353
if n == 1:
    print(1)
elif n > m:
    print(1)
elif n == m:
    print(2)
else:
    a = [1] * (n - 1) + [2]
    for i in range(10 ** 6 + 1):
        a.append((a[-1] + a[-n]) % mod)
    print(a[m - 1])
0