結果
問題 |
No.1681 +-*
|
ユーザー |
![]() |
提出日時 | 2025-03-26 15:49:25 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 319 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 102,436 KB |
最終ジャッジ日時 | 2025-03-26 15:50:12 |
合計ジャッジ時間 | 2,769 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
MOD = 10**9 + 7 N = int(input()) A = list(map(int, input().split())) if N == 0: print(0) else: total_sum = 0 current_product = A[0] % MOD for i in range(1, N): a = A[i] % MOD new_total = (3 * total_sum + 2 * current_product) % MOD new_product = (current_product * a) % MOD total_sum, current_product = new_total, new_product result = (total_sum + current_product) % MOD print(result)