結果
問題 | No.607 開通777年記念 |
ユーザー |
![]() |
提出日時 | 2018-04-24 18:29:34 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 145 ms / 2,000 ms |
コード長 | 662 bytes |
コンパイル時間 | 48 ms |
コンパイル使用メモリ | 6,940 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 16:02:13 |
合計ジャッジ時間 | 1,022 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
print((function (f, g, m)local a = f()if a==true then return "YES" endfor _=2,m do if g(a) then return "YES" end endreturn "NO"end)(function ()local a = {0}for e in io.stdin:read("*l"):gmatch("%d+") doif e=="777" then return true ende=tonumber(e) table.insert(a,e) a[1]=a[1]+eendreturn aend, function (a)local i = 2for 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 endif a[1]<777 then return false endfor i=2,#a do local t=0 for j=i,#a do t=t+a[j]if t==777 then return true endif t>777 then break endend endreturn falseend, tonumber(io.stdin:read("*l"):match("%d+%s(%d+)"))))