結果

問題 No.593 4進FizzBuzz
ユーザー nobigomunobigomu
提出日時 2018-03-25 13:37:29
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 5,968 KB
最終ジャッジ日時 2023-09-07 11:42:34
合計ジャッジ時間 7,914 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 216 ms
5,892 KB
testcase_17 AC 218 ms
5,808 KB
testcase_18 AC 217 ms
5,892 KB
testcase_19 AC 217 ms
5,892 KB
testcase_20 AC 216 ms
5,916 KB
testcase_21 AC 215 ms
5,924 KB
testcase_22 AC 217 ms
5,784 KB
testcase_23 AC 216 ms
5,804 KB
testcase_24 AC 216 ms
5,888 KB
testcase_25 AC 216 ms
5,928 KB
testcase_26 AC 217 ms
5,920 KB
testcase_27 AC 216 ms
5,968 KB
testcase_28 AC 216 ms
5,880 KB
testcase_29 AC 216 ms
5,868 KB
testcase_30 AC 201 ms
5,920 KB
testcase_31 AC 200 ms
5,856 KB
testcase_32 AC 201 ms
5,828 KB
testcase_33 AC 204 ms
5,920 KB
testcase_34 AC 202 ms
5,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")))
0