結果

問題 No.1336 Union on Blackboard
ユーザー H3PO4H3PO4
提出日時 2021-01-15 21:35:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-26 13:31:54
合計ジャッジ時間 2,516 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7


def solve(N, A):
    res = A[0]
    for a in A[1:]:
        res = res * a + res + a
        res %= MOD
    return res


T = int(input())
for _ in range(T):
    N = int(input())
    A = tuple(map(int, input().split()))
    print(solve(N, A))
0