結果
問題 |
No.1237 EXP Multiple!
|
ユーザー |
|
提出日時 | 2020-10-09 06:26:19 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 313 ms / 2,000 ms |
コード長 | 352 bytes |
コンパイル時間 | 69 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 29,696 KB |
最終ジャッジ日時 | 2024-07-20 06:38:27 |
合計ジャッジ時間 | 5,512 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
コンパイルメッセージ
Syntax OK
ソースコード
# 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.reduce(1) do |result, item| x = result * item**item.fact x > L ? (return L) : x end) end end N = gets.to_i A = gets.split.map(&:to_i) puts solve