結果
問題 |
No.593 4進FizzBuzz
|
ユーザー |
![]() |
提出日時 | 2018-03-25 13:37:29 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 194 ms / 2,000 ms |
コード長 | 402 bytes |
コンパイル時間 | 198 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-06-25 05:51:37 |
合計ジャッジ時間 | 6,617 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 for e in s:gmatch(".") do 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")))