結果

問題 No.1237 EXP Multiple!
コンテスト
ユーザー hiraku
提出日時 2020-10-27 09:54:48
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 395 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 443 ms
コンパイル使用メモリ 20,832 KB
実行使用メモリ 36,160 KB
最終ジャッジ日時 2026-04-03 06:09:34
合計ジャッジ時間 3,776 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# No.1237 EXP Multiple!
# https://yukicoder.me/problems/no/1237

from math import factorial

def f(x):
  return x ** factorial(x)

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

MOD = 10 ** 9 + 7

if any(a == 0 for a in A):
  print(0)
  exit()

if any(a > 9 for a in A):
  print(MOD)
  exit()

ans = 1
for a in A:
  if ans >= MOD:
    print(MOD)
    exit()
  ans *= f(a)

print(MOD % ans)
0