結果

問題 No.73 helloworld
ユーザー nobigomunobigomu
提出日時 2018-05-09 17:11:01
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 5,404 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 19:00:22
合計ジャッジ時間 1,118 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require 'ffi'
local C = ffi.C
ffi.cdef 'int printf(const char *, ...);'

C.printf("%lu\n", (function (f, g, h)
	local h,r={[4]={1,f},[5]={1,f},[8]={1,f},[12]={3,h},[15]={2,g},[18]={1,f},[23]={1,f}},1ULL
	for i=1,26 do
		local n=io.stdin:read("*n")
		if h[i]~=nil then if n<h[i][1] then return 0ULL end r=r*h[i][2](n) end
	end
	return r
end)(function (n)
	return n
end, function (n)
	return n%2==0 and (n/2)^2 or math.floor(n/2)*(math.floor(n/2)+1)
end, function (n)
	function f(n) return (n-1)*n/2 end
	local r=f(n-1)
	for i=n-2,2,-1 do
		local t=f(i)*(n-i)
		if t>r then r=t elseif r<t then break end
	end
	return r
end))
0