結果
| 問題 |
No.933 おまわりさんこいつです
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2019-11-30 21:05:00 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 131 ms / 2,000 ms |
| コード長 | 630 bytes |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 6,688 KB |
| 実行使用メモリ | 9,480 KB |
| 最終ジャッジ日時 | 2024-11-21 03:33:04 |
| 合計ジャッジ時間 | 1,337 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
local function lltonumber(str)
local ret = 0LL
local sign = str:sub(1, 1) ~= "-"
local begin = sign and 1 or 2
for i = begin, #str do
ret = ret * 10LL
ret = ret + tonumber(str:sub(i, i))
end
if not sign then ret = ret * -1LL end
return ret
end
local n = io.read("*n", "*l")
local s = io.read()
local a = 1
for ss in s:gmatch("%d+") do
local p = lltonumber(ss)
if p == 0LL then
a = -1
break
else
p = p % 9LL
local str = tostring(p):gsub("LL", "")
local p32 = tonumber(str)
a = (a * p32) % 9
end
end
if a == -1 then
print(0)
elseif a == 0 then
print(9)
else
print(a)
end