結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2019-03-24 23:25:30 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 271 bytes |
| コンパイル時間 | 338 ms |
| コンパイル使用メモリ | 6,948 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-16 22:02:38 |
| 合計ジャッジ時間 | 856 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
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 x = x - 1 else y = y - 1 end
end
d = math.sqrt(x * x + y * y)
io.write(string.format("%.5f", d))