結果

問題 No.1237 EXP Multiple!
ユーザー gemmarogemmaro
提出日時 2020-10-09 06:17:17
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 281 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 11,492 KB
実行使用メモリ 28,728 KB
最終ジャッジ日時 2023-09-27 12:30:47
合計ジャッジ時間 6,838 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
15,052 KB
testcase_01 AC 145 ms
24,488 KB
testcase_02 AC 156 ms
28,300 KB
testcase_03 AC 164 ms
28,360 KB
testcase_04 AC 162 ms
28,728 KB
testcase_05 AC 130 ms
26,960 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

L = 10**9 + 7

class Integer
  def fact
    (1..self).reduce(:*)
  end
end

def solve
  if A.any?(&:zero?)
    -1
  elsif A.max >= 4
    L
  else
    L % A.map { _1**_1.fact }.reduce(:*)
  end
end

N = gets.to_i
A = gets.split.map(&:to_i)
puts solve
0