結果

問題 No.1237 EXP Multiple!
ユーザー laneguelanegue
提出日時 2020-09-26 12:14:11
言語 Ruby
(3.3.0)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 207 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 11,200 KB
実行使用メモリ 31,496 KB
最終ジャッジ日時 2023-09-11 08:04:45
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,040 KB
testcase_01 AC 164 ms
25,772 KB
testcase_02 AC 193 ms
29,420 KB
testcase_03 AC 195 ms
30,156 KB
testcase_04 AC 170 ms
30,076 KB
testcase_05 AC 161 ms
28,496 KB
testcase_06 AC 160 ms
28,456 KB
testcase_07 AC 166 ms
28,556 KB
testcase_08 AC 261 ms
31,248 KB
testcase_09 AC 161 ms
28,332 KB
testcase_10 AC 168 ms
28,452 KB
testcase_11 AC 164 ms
28,412 KB
testcase_12 AC 161 ms
28,364 KB
testcase_13 AC 261 ms
31,300 KB
testcase_14 AC 261 ms
31,372 KB
testcase_15 AC 262 ms
31,352 KB
testcase_16 AC 261 ms
31,496 KB
testcase_17 AC 262 ms
31,464 KB
testcase_18 AC 262 ms
31,372 KB
testcase_19 AC 161 ms
28,560 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

M=10**9+7
N=gets.to_i
A=gets.split.map(&:to_i)
A.sort!
m=1
if A[0]==0
    puts -1
elsif A[-1]>3
    puts M
else
    A.each{|a|
        m*= a ** (1..a).inject(&:*)
        break if m>M
    }
    puts M%m
end
0