結果

問題 No.314 ケンケンパ
ユーザー iga_xxiga_xx
提出日時 2015-12-07 06:13:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 501 ms / 1,000 ms
コード長 462 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 7,932 KB
最終ジャッジ日時 2023-10-12 19:43:09
合計ジャッジ時間 3,292 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 489 ms
7,716 KB
testcase_01 AC 16 ms
7,780 KB
testcase_02 AC 15 ms
7,792 KB
testcase_03 AC 16 ms
7,724 KB
testcase_04 AC 16 ms
7,784 KB
testcase_05 AC 16 ms
7,776 KB
testcase_06 AC 16 ms
7,932 KB
testcase_07 AC 16 ms
7,868 KB
testcase_08 AC 16 ms
7,912 KB
testcase_09 AC 16 ms
7,752 KB
testcase_10 AC 16 ms
7,832 KB
testcase_11 AC 16 ms
7,716 KB
testcase_12 AC 16 ms
7,788 KB
testcase_13 AC 16 ms
7,780 KB
testcase_14 AC 19 ms
7,824 KB
testcase_15 AC 20 ms
7,832 KB
testcase_16 AC 28 ms
7,716 KB
testcase_17 AC 66 ms
7,792 KB
testcase_18 AC 251 ms
7,892 KB
testcase_19 AC 501 ms
7,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

old_first_ken = 1
old_second_ken = 0
old_pa = 0

new_first_ken = 0
new_second_ken = 0
new_pa = 0

for i in range(1, N):
    new_first_ken = old_pa
    new_second_ken = old_first_ken
    new_pa = (old_first_ken + old_second_ken) % 1000000007

    old_first_ken = new_first_ken
    old_second_ken = new_second_ken
    old_pa = new_pa

    new_first_ken = new_second_ken = new_pa = 0

print((old_first_ken + old_second_ken + old_pa) % 1000000007)
0