結果
| 問題 | 
                            No.81 すべて足すだけの簡単なお仕事です。
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nobigomu
                         | 
                    
| 提出日時 | 2018-07-30 17:59:18 | 
| 言語 | Lua  (LuaJit 2.1.1734355927)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,213 bytes | 
| コンパイル時間 | 215 ms | 
| コンパイル使用メモリ | 5,376 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-26 10:14:37 | 
| 合計ジャッジ時間 | 1,455 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 WA * 5 | 
ソースコード
print((function (f1, f2, f3, g)
	local i,f=g()
	if (f>=1e10 and i>=0) or (f<=-1e10 and i<0) then return f1(i,f) end
	if f>=1e10 or f<=-1e10 then return f2(i,f) end
	return f3(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)
	local s=tostring(f)
	local a,b=tonumber(s:sub(1,#s-10)),tonumber(s:sub(#s-9))
	if b==0 then return tostring(i+a)..".0000000000" end
	a,b = tostring(i+(a>0 and a+1 or a-1)),tostring(math.abs(tonumber(s:sub(#s-9))-1e10))
	if a=="0" and i<0 then a="-0" end
	return a.."."..string.rep("0",10-#b)..b
end, function (i, f)
	if f==0 then return tostring(i)..".0000000000" end
	if i==0 then return f>0 and "0."..tostring(f) or "-0."..tostring(f):sub(2) end
	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))
            
            
            
        
            
nobigomu