結果

問題 No.1237 EXP Multiple!
ユーザー IH
提出日時 2020-09-26 21:28:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,734 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 107,500 KB
最終ジャッジ日時 2024-06-29 21:25:53
合計ジャッジ時間 13,292 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n = int(input())
a = list(map(int,input().split()))

if min(a) == 0:
  print(-1)
  exit()
elif max(a) >= 4:
  print(((10)**9)+7)
  exit()
else:
  ans = 1
  for i in range(n):
    tmp = math.factorial(a[i])
    ans *= a[i]**tmp
    if ans >= ((10)**9)+7:
      print((10**9)+7)
      exit()
  print(((10**9)+7)%ans)
0