結果

問題 No.314 ケンケンパ
ユーザー roiti46roiti46
提出日時 2015-12-05 16:14:22
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 424 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 6,532 KB
実行使用メモリ 197,064 KB
最終ジャッジ日時 2023-10-12 15:43:42
合計ジャッジ時間 6,390 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 11 ms
5,872 KB
testcase_02 AC 11 ms
5,884 KB
testcase_03 AC 10 ms
5,876 KB
testcase_04 AC 11 ms
5,944 KB
testcase_05 AC 11 ms
5,872 KB
testcase_06 AC 11 ms
5,944 KB
testcase_07 AC 11 ms
6,000 KB
testcase_08 AC 11 ms
6,048 KB
testcase_09 AC 11 ms
5,932 KB
testcase_10 AC 11 ms
5,888 KB
testcase_11 AC 12 ms
5,996 KB
testcase_12 AC 11 ms
6,192 KB
testcase_13 AC 12 ms
6,112 KB
testcase_14 AC 17 ms
6,864 KB
testcase_15 AC 22 ms
7,488 KB
testcase_16 AC 38 ms
10,480 KB
testcase_17 AC 126 ms
24,892 KB
testcase_18 AC 643 ms
97,216 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#-*- coding: utf-8 -*-
mod = 10**9 + 7
N = int(raw_input())
dp = [[0] * 3 for i in xrange(N)]
# 「ケン」からスタート
dp[0][1] = 1
for i in xrange(1, N):
    #「パ」になる場合
    dp[i][0] = (dp[i - 1][1] + dp[i - 1][2]) % mod
    #1回めの「ケン」で進む場合
    dp[i][1] = dp[i - 1][0] % mod
    #2回めの「ケン」で進む場合
    dp[i][2] = dp[i - 1][1] % mod
print sum(dp[N - 1]) % mod
0