結果

問題 No.1186 長方形の敷き詰め
ユーザー tcltktcltk
提出日時 2021-01-17 14:48:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 868 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 97,508 KB
最終ジャッジ日時 2024-05-07 03:50:45
合計ジャッジ時間 5,200 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
89,312 KB
testcase_01 AC 138 ms
89,248 KB
testcase_02 AC 137 ms
89,456 KB
testcase_03 AC 138 ms
89,176 KB
testcase_04 AC 139 ms
89,188 KB
testcase_05 AC 138 ms
89,268 KB
testcase_06 AC 138 ms
89,324 KB
testcase_07 AC 135 ms
89,304 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 135 ms
89,308 KB
testcase_12 AC 140 ms
89,028 KB
testcase_13 AC 136 ms
89,380 KB
testcase_14 AC 137 ms
89,212 KB
testcase_15 AC 138 ms
89,236 KB
testcase_16 AC 145 ms
89,216 KB
testcase_17 AC 142 ms
89,524 KB
testcase_18 AC 140 ms
89,220 KB
testcase_19 AC 138 ms
89,040 KB
testcase_20 AC 139 ms
89,260 KB
testcase_21 AC 135 ms
88,856 KB
testcase_22 AC 155 ms
97,380 KB
testcase_23 AC 149 ms
93,836 KB
testcase_24 AC 156 ms
96,028 KB
testcase_25 AC 150 ms
93,696 KB
testcase_26 AC 137 ms
89,228 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 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