結果

問題 No.978 Fibonacci Convolution Easy
ユーザー realDivineJKrealDivineJK
提出日時 2020-10-10 12:16:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 210 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 75,972 KB
最終ジャッジ日時 2023-09-27 21:22:43
合計ジャッジ時間 4,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
75,768 KB
testcase_01 AC 78 ms
75,672 KB
testcase_02 AC 76 ms
75,748 KB
testcase_03 AC 93 ms
75,940 KB
testcase_04 AC 74 ms
75,600 KB
testcase_05 AC 70 ms
75,848 KB
testcase_06 AC 76 ms
75,704 KB
testcase_07 AC 83 ms
75,836 KB
testcase_08 AC 81 ms
75,824 KB
testcase_09 AC 85 ms
75,856 KB
testcase_10 AC 93 ms
75,832 KB
testcase_11 AC 77 ms
75,888 KB
testcase_12 AC 72 ms
75,672 KB
testcase_13 AC 78 ms
75,720 KB
testcase_14 AC 72 ms
75,704 KB
testcase_15 AC 77 ms
75,800 KB
testcase_16 AC 94 ms
75,920 KB
testcase_17 AC 92 ms
75,972 KB
testcase_18 AC 69 ms
71,388 KB
testcase_19 AC 70 ms
71,288 KB
testcase_20 AC 68 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, p = map(int, input().split())
mod = 1000000007

a, b = 0, 1
S = 0
SS = 0
tmp = 0
for i in range(N):
    S += a * SS % mod
    S %= mod
    a, b = b, (a + p * b) % mod
    SS += a % mod
    SS %= mod
print(S)
0