結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
nobigomu
|
| 提出日時 | 2018-04-22 16:33:00 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 295 bytes |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 5,248 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 21:53:02 |
| 合計ジャッジ時間 | 1,075 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
print((function (f, s)
return f(s)
end)(function (s)
local x,y = 0,0
for i=1,#s do
local c = s:sub(i,i)
if c=="E" then x=x+1 end
if c=="W" then x=x-1 end
if c=="S" then y=y-1 end
if c=="N" then y=y+1 end
end
return math.sqrt(math.pow(x,2)+math.pow(y,2))
end, io.stdin:read("*l")))
nobigomu