結果

問題 No.1237 EXP Multiple!
ユーザー suzuishi
提出日時 2024-07-13 23:15:02
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 260 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 26,240 KB
最終ジャッジ日時 2024-07-13 23:15:08
合計ジャッジ時間 6,011 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 12 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 : ans
end
0