結果

問題 No.1186 長方形の敷き詰め
ユーザー yatsurugiyatsurugi
提出日時 2020-09-26 15:08:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 332 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 817,020 KB
最終ジャッジ日時 2023-09-11 11:57:09
合計ジャッジ時間 3,264 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,932 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 16 ms
8,136 KB
testcase_03 AC 16 ms
7,840 KB
testcase_04 AC 16 ms
7,840 KB
testcase_05 AC 16 ms
8,176 KB
testcase_06 AC 16 ms
8,308 KB
testcase_07 AC 16 ms
8,300 KB
testcase_08 AC 16 ms
8,136 KB
testcase_09 AC 15 ms
8,116 KB
testcase_10 AC 16 ms
8,304 KB
testcase_11 AC 16 ms
8,296 KB
testcase_12 AC 15 ms
8,188 KB
testcase_13 AC 16 ms
8,100 KB
testcase_14 AC 15 ms
8,120 KB
testcase_15 AC 15 ms
8,036 KB
testcase_16 WA -
testcase_17 AC 15 ms
8,180 KB
testcase_18 AC 15 ms
8,188 KB
testcase_19 AC 16 ms
8,172 KB
testcase_20 AC 16 ms
8,208 KB
testcase_21 AC 16 ms
8,172 KB
testcase_22 MLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())

if N == 1 or N > M:
    print(1)
    exit()
if N == M:
    print(2)
    exit()

dp = [0] * (M + 2)
dp[0] = 1

if N == 2:
    for i in range(M + 1):
        dp[i + 1] = dp[i] + dp[i - 1]
else:
    dp[1], dp[2] = 1, 1
    for i in range(3, M + 1):
        dp[i] = dp[i - 1] + dp[i - 3]

print(dp[M])
0