結果

問題 No.1084 積の積
ユーザー uni_pythonuni_python
提出日時 2020-06-20 10:19:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 90,788 KB
最終ジャッジ日時 2023-09-16 17:01:12
合計ジャッジ時間 6,491 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,424 KB
testcase_01 AC 77 ms
71,300 KB
testcase_02 AC 74 ms
71,252 KB
testcase_03 AC 72 ms
71,284 KB
testcase_04 AC 174 ms
89,016 KB
testcase_05 AC 90 ms
88,324 KB
testcase_06 AC 131 ms
89,016 KB
testcase_07 AC 75 ms
71,136 KB
testcase_08 AC 75 ms
71,404 KB
testcase_09 AC 94 ms
89,784 KB
testcase_10 AC 76 ms
71,440 KB
testcase_11 AC 85 ms
76,464 KB
testcase_12 AC 129 ms
81,836 KB
testcase_13 AC 181 ms
88,776 KB
testcase_14 AC 117 ms
79,652 KB
testcase_15 AC 114 ms
79,608 KB
testcase_16 AC 196 ms
90,788 KB
testcase_17 AC 126 ms
81,004 KB
testcase_18 AC 157 ms
85,656 KB
testcase_19 AC 178 ms
88,972 KB
testcase_20 AC 103 ms
77,336 KB
testcase_21 AC 120 ms
79,728 KB
testcase_22 AC 108 ms
78,340 KB
testcase_23 AC 142 ms
83,560 KB
testcase_24 AC 136 ms
82,236 KB
testcase_25 AC 182 ms
89,004 KB
testcase_26 AC 209 ms
89,664 KB
testcase_27 AC 218 ms
89,964 KB
testcase_28 AC 209 ms
89,460 KB
testcase_29 AC 215 ms
89,920 KB
testcase_30 AC 212 ms
89,980 KB
testcase_31 AC 213 ms
89,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

def main():
    import bisect
    
    N=I()
    A=LI()
    ans=1
    flag=0
    if min(A)==0:
        print(0)
    else:

            
        ceil=10**9
        now=1
        temp=1
        ans=1
        l=0
        
        for r in range(N):
            now*=A[r]
            temp=(temp*pow(A[r],r-l+1,mod))%mod
            
            while now>=ceil:
                temp=(temp*pow(now,mod-2,mod))
                now=now//A[l]
                l+=1
            ans=(ans*temp)%mod
            
        print(ans%mod)
            


main()
0