結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー nobigomu
提出日時 2018-03-25 00:24:29
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 277 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 19:01:19
合計ジャッジ時間 954 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

print((function (f, s)
	return f(s)
end)(function (s)
	function f(n)
		local isF,isB = n%3==0,n%5==0
		return (isF and isB) and 8 or
			(isF or isB) and 4 or #tostring(n)
	end
	local r = 0
	s:gsub("%d+", function (e) r=r+f(tonumber(e)) end)
	return r
end, io.stdin:read("*l")))
0