結果

問題 No.1237 EXP Multiple!
ユーザー 👑 obakyanobakyan
提出日時 2020-10-04 09:52:33
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 5,292 KB
実行使用メモリ 4,716 KB
最終ジャッジ日時 2023-09-26 11:11:59
合計ジャッジ時間 2,099 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 36 ms
4,532 KB
testcase_02 AC 46 ms
4,516 KB
testcase_03 AC 47 ms
4,580 KB
testcase_04 AC 48 ms
4,664 KB
testcase_05 AC 31 ms
4,504 KB
testcase_06 AC 38 ms
4,580 KB
testcase_07 AC 36 ms
4,660 KB
testcase_08 AC 39 ms
4,592 KB
testcase_09 AC 38 ms
4,516 KB
testcase_10 AC 40 ms
4,624 KB
testcase_11 AC 38 ms
4,508 KB
testcase_12 AC 39 ms
4,716 KB
testcase_13 AC 39 ms
4,384 KB
testcase_14 AC 39 ms
4,380 KB
testcase_15 AC 39 ms
4,380 KB
testcase_16 AC 39 ms
4,380 KB
testcase_17 AC 39 ms
4,380 KB
testcase_18 AC 39 ms
4,380 KB
testcase_19 AC 39 ms
4,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n = io.read("*n")
local a = {}
local zero = false
for i = 1, n do
  a[i] = io.read("*n")
  if a[i] == 0 then zero = true end
end
if zero then
  print(-1) os.exit()
end
local ret = 1
for i = 1, n do
  if 4 <= a[i] then
    print(1000000007) os.exit()
  elseif 3 == a[i] then
    ret = ret * 729
  elseif 2 == a[i] then
    ret = ret * 4
  end
  if 1000000007 < ret then
    print(1000000007) os.exit()
  end
end
print(1000000007 % ret)
0