結果
| 問題 | No.593 4進FizzBuzz |
| コンテスト | |
| ユーザー |
nobigomu
|
| 提出日時 | 2018-03-23 17:39:14 |
| 言語 | Lua (LuaJit 2.1.1765228720) |
| 結果 |
AC
|
| 実行時間 | 264 ms / 2,000 ms |
| コード長 | 400 bytes |
| 記録 | |
| コンパイル時間 | 36 ms |
| コンパイル使用メモリ | 6,812 KB |
| 実行使用メモリ | 10,884 KB |
| 最終ジャッジ日時 | 2024-06-24 21:31:04 |
| 合計ジャッジ時間 | 6,647 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
print((function (f, s)
return f(s)
end)(function (s)
function mod15()
local band, lshift = bit.band, bit.lshift
local r, i = 0, #s
s:gsub(".", function (e)
e = tonumber(e)
if band(i,1) == 0 then e = lshift(e,2) end
r, i = r+e, i-1 end)
return r%15
end
local n = mod15()
return n == 0 and "FizzBuzz" or
n%3 == 0 and "Fizz" or n%5 == 0 and "Buzz" or s
end, io.stdin:read("*l")))
nobigomu