結果

問題 No.1237 EXP Multiple!
ユーザー suzuishi
提出日時 2024-07-13 23:16:17
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 26,112 KB
最終ジャッジ日時 2024-07-13 23:16:25
合計ジャッジ時間 5,179 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

Mod = 10 ** 9 + 7
n = gets.to_i
a = gets.split.map &:to_i
if a.any? {|i| i >= 4} then
  puts Mod
else
  ans = 1
  f = [0, 1, 4, 3 ** 6]
  a.each do |i|
    ans *= f[i]
    if ans > Mod then
      puts Mod
      exit
    end
  end
  puts ans == 0 ? -1 : Mod % ans
end
0