結果

問題 No.1186 長方形の敷き詰め
ユーザー tcltktcltk
提出日時 2021-01-17 14:50:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 906 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 91,488 KB
最終ジャッジ日時 2023-08-19 20:49:01
合計ジャッジ時間 7,723 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
83,004 KB
testcase_01 AC 221 ms
83,032 KB
testcase_02 AC 224 ms
83,388 KB
testcase_03 AC 220 ms
83,228 KB
testcase_04 AC 220 ms
83,044 KB
testcase_05 AC 222 ms
83,228 KB
testcase_06 AC 223 ms
83,240 KB
testcase_07 AC 222 ms
83,004 KB
testcase_08 AC 220 ms
83,348 KB
testcase_09 AC 222 ms
82,948 KB
testcase_10 AC 223 ms
83,196 KB
testcase_11 AC 220 ms
83,088 KB
testcase_12 AC 219 ms
82,940 KB
testcase_13 AC 221 ms
83,000 KB
testcase_14 AC 222 ms
83,216 KB
testcase_15 AC 223 ms
83,228 KB
testcase_16 AC 221 ms
83,644 KB
testcase_17 AC 220 ms
83,176 KB
testcase_18 AC 222 ms
83,236 KB
testcase_19 AC 221 ms
82,944 KB
testcase_20 AC 221 ms
83,392 KB
testcase_21 AC 226 ms
83,000 KB
testcase_22 AC 239 ms
91,488 KB
testcase_23 AC 234 ms
88,052 KB
testcase_24 AC 237 ms
90,532 KB
testcase_25 AC 232 ms
88,244 KB
testcase_26 AC 223 ms
83,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

MOD = 998244353

def solve(N, M):

    if N == 1:
        return 1

    elif M < N:
        return 1

    elif M == N:
        return 2

    else:
        dp = [0 for _ in range(M+1)]
        dp[0] = 1
        for i in range(M):
            dp[i+1] = (dp[i+1] + dp[i]) % MOD
            if i+N <= M:
                dp[i+N] = (dp[i+N] + dp[i]) % MOD
        return dp[M]

def main():
    N, M = map(int, input().split())
    print(solve(N, M))

if __name__ == '__main__':
    main()
0