結果

問題 No.533 Mysterious Stairs
ユーザー TsubajiroTsubajiro
提出日時 2023-08-04 21:19:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 371 ms / 5,000 ms
コード長 378 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 172,532 KB
最終ジャッジ日時 2024-04-22 19:30:17
合計ジャッジ時間 4,418 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
51,840 KB
testcase_01 AC 47 ms
52,352 KB
testcase_02 AC 48 ms
51,840 KB
testcase_03 AC 46 ms
52,224 KB
testcase_04 AC 49 ms
52,096 KB
testcase_05 AC 46 ms
52,156 KB
testcase_06 AC 42 ms
52,480 KB
testcase_07 AC 45 ms
52,480 KB
testcase_08 AC 47 ms
52,224 KB
testcase_09 AC 43 ms
52,096 KB
testcase_10 AC 47 ms
59,008 KB
testcase_11 AC 59 ms
60,672 KB
testcase_12 AC 59 ms
61,856 KB
testcase_13 AC 62 ms
62,080 KB
testcase_14 AC 55 ms
61,696 KB
testcase_15 AC 63 ms
62,336 KB
testcase_16 AC 62 ms
62,848 KB
testcase_17 AC 64 ms
63,232 KB
testcase_18 AC 62 ms
64,128 KB
testcase_19 AC 59 ms
65,152 KB
testcase_20 AC 98 ms
87,148 KB
testcase_21 AC 102 ms
88,704 KB
testcase_22 AC 181 ms
113,392 KB
testcase_23 AC 371 ms
171,520 KB
testcase_24 AC 369 ms
172,532 KB
testcase_25 AC 102 ms
87,580 KB
testcase_26 AC 329 ms
159,616 KB
testcase_27 AC 150 ms
101,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
dp = [[0]*3 for _ in range(N+1)]
dp[1][0]=1
if N>=2:
    dp[2][1]=1
if N>=3:
    dp[3][2]=1
mod=10**9+7

for i in range(0,N):
    for j in range(3):
        for jj in range(3):
            if j==jj:
                continue
            if i+jj+1>N:
                break
            dp[i+jj+1][jj]+=dp[i][j]
            dp[i+jj+1][jj]%=mod
print(sum(dp[-1])%mod)
0