結果

問題 No.1084 積の積
ユーザー c-yanc-yan
提出日時 2020-06-20 06:21:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 514 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 18,780 KB
最終ジャッジ日時 2023-09-16 16:50:08
合計ジャッジ時間 9,251 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,856 KB
testcase_01 AC 14 ms
7,800 KB
testcase_02 AC 15 ms
7,712 KB
testcase_03 AC 16 ms
7,936 KB
testcase_04 AC 181 ms
9,944 KB
testcase_05 AC 139 ms
9,884 KB
testcase_06 AC 164 ms
9,888 KB
testcase_07 AC 15 ms
7,876 KB
testcase_08 AC 14 ms
7,828 KB
testcase_09 AC 373 ms
18,184 KB
testcase_10 AC 15 ms
7,804 KB
testcase_11 AC 31 ms
8,320 KB
testcase_12 AC 213 ms
12,640 KB
testcase_13 AC 424 ms
17,340 KB
testcase_14 AC 172 ms
11,244 KB
testcase_15 AC 156 ms
11,192 KB
testcase_16 AC 508 ms
18,780 KB
testcase_17 AC 197 ms
12,100 KB
testcase_18 AC 329 ms
15,148 KB
testcase_19 AC 442 ms
17,632 KB
testcase_20 AC 109 ms
10,112 KB
testcase_21 AC 169 ms
11,580 KB
testcase_22 AC 131 ms
10,812 KB
testcase_23 AC 267 ms
13,868 KB
testcase_24 AC 245 ms
13,276 KB
testcase_25 AC 434 ms
17,624 KB
testcase_26 AC 504 ms
18,556 KB
testcase_27 AC 511 ms
18,540 KB
testcase_28 AC 514 ms
18,548 KB
testcase_29 AC 506 ms
18,608 KB
testcase_30 AC 505 ms
18,552 KB
testcase_31 AC 511 ms
18,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

m = 1000000007
l = 0
a = 1
b = 1
result = 1
for r in range(N):
    a *= A[r]
    b *= pow(A[r], r - l + 1, m)
    b %= m
    while a >= 1000000000:
        b *= pow(a, m - 2, m)
        a //= A[l]
        l += 1
    result *= b
    result %= m
print(result)
0