結果

問題 No.607 開通777年記念
ユーザー nobigomunobigomu
提出日時 2018-04-24 18:29:34
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 23:36:47
合計ジャッジ時間 1,306 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

print((function (f, g, m)
	local a = f()
	if a==true then return "YES" end
	for _=2,m do if g(a) then return "YES" end end
	return "NO"	
end)(function ()
	local a = {0}
	for e in io.stdin:read("*l"):gmatch("%d+") do
		if e=="777" then return true end
		e=tonumber(e) table.insert(a,e) a[1]=a[1]+e
	end
	return a
end, function (a)
	local i = 2
	for e in io.stdin:read("*l"):gmatch("%-?%d+") do e=tonumber(e) a[1],a[i],i=a[1]+e,a[i]+e,i+1 end
	if a[1]<777 then return false end
	for i=2,#a do local t=0 for j=i,#a do t=t+a[j]
		if t==777 then return true end
		if t>777 then break end
	end end
	return false
end, tonumber(io.stdin:read("*l"):match("%d+%s(%d+)"))))
0