結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,872 KB
testcase_01 AC 15 ms
7,784 KB
testcase_02 AC 15 ms
7,904 KB
testcase_03 AC 15 ms
7,912 KB
testcase_04 AC 167 ms
10,072 KB
testcase_05 AC 140 ms
10,044 KB
testcase_06 AC 152 ms
9,980 KB
testcase_07 AC 15 ms
7,784 KB
testcase_08 AC 14 ms
7,916 KB
testcase_09 AC 360 ms
18,112 KB
testcase_10 AC 15 ms
7,908 KB
testcase_11 AC 30 ms
8,340 KB
testcase_12 AC 208 ms
12,448 KB
testcase_13 AC 427 ms
17,408 KB
testcase_14 AC 170 ms
11,340 KB
testcase_15 AC 152 ms
11,156 KB
testcase_16 AC 495 ms
18,832 KB
testcase_17 AC 190 ms
12,168 KB
testcase_18 AC 317 ms
15,048 KB
testcase_19 AC 433 ms
17,652 KB
testcase_20 AC 112 ms
10,036 KB
testcase_21 AC 172 ms
11,524 KB
testcase_22 AC 134 ms
10,828 KB
testcase_23 AC 271 ms
13,984 KB
testcase_24 AC 246 ms
13,464 KB
testcase_25 AC 440 ms
17,796 KB
testcase_26 AC 503 ms
18,524 KB
testcase_27 AC 514 ms
18,564 KB
testcase_28 AC 517 ms
18,508 KB
testcase_29 AC 510 ms
18,644 KB
testcase_30 AC 519 ms
18,472 KB
testcase_31 AC 509 ms
18,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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