結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー nobigomunobigomu
提出日時 2018-07-04 18:03:41
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 764 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 17:33:29
合計ジャッジ時間 1,556 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 1 ms
4,376 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

print((function (f1, f2, g)
	local i,f=g()
	if f==0 then return tostring(i)..".0000000000" end
	if (f>0 and f>=1e10) or (f<0 and f<=-1e10) then return f1(i,f) end
	return f2(i,f)	
end)(function (i, f)
	local s=tostring(f)
	return tostring(i+tonumber(s:sub(1,#s-10))).."."..s:sub(#s-9)
end, function (i, f)
	if f>0 and i<0 then i,f = i+1,math.abs(f-1e10) end
	if f<0 and i>=0 then i,f = i-1,math.abs(f+1e10) end
	local s=tostring(f)
	return tostring(i).."."..string.rep("0",10-#s)..s
end, function ()
	local i,f=0,0
	for _=1,tonumber(io.stdin:read("*l")) do
		local a,b,c = io.stdin:read("*l"):match("(%-?)(%d+)%.?(%d*)")
		b,c = tonumber(b),(#c~=0 and tonumber(c..string.rep("0",10-#c)) or 0)
		if a=="" then i,f=i+b,f+c else i,f=i-b,f-c end
	end
	return i,f
end))
0