結果

問題 No.604 誕生日のお小遣い
ユーザー nobigomu
提出日時 2018-03-28 19:22:33
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 380 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 19:23:08
合計ジャッジ時間 886 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require 'ffi'
local C = ffi.C

ffi.cdef [[
long atol(const char *);
int printf(const char *, ...);
]]

C.printf("%ld\n", (function (f, s)
	return f(s)
end)(function (s)
	local a,b,c = s:match("(%d+)%s(%d+)%s(%d+)")
	a,b,c = C.atol(a),C.atol(b),C.atol(c)

	if a > c then return c end

	local d = a-1LL+b
	return c/d*a + (c%d < a and c%d or a)
end, io.stdin:read("*l")))
0