結果

問題 No.113 宝探し
ユーザー 👑 obakyan
提出日時 2019-03-24 23:24:00
言語 Lua
(LuaJit 2.1.1734355927)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 19:42:49
合計ジャッジ時間 1,162 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 12 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

s = io.read()
n = string.len(s)
x = 0
y = 0
for i = 1, n, 1 do
    c = string.sub(s, i, i)
    if c == "N" then y = y + 1 elseif c == "E" then x = x + 1 elseif c == "W" then y = y - 1 else x = x - 1 end
end
d = math.sqrt(x * x + y * y)
io.write(string.format("%.5f", d))
0