結果
問題 | No.113 宝探し |
ユーザー |
![]() |
提出日時 | 2014-12-29 00:01:48 |
言語 | Ruby (3.4.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 357 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-06-13 00:01:13 |
合計ジャッジ時間 | 3,515 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 RE * 11 |
コンパイルメッセージ
Syntax OK
ソースコード
strs = gets.to_s.chomp.split("")e = strs.count("E")n = strs.count("N")s = strs.count("S")w = strs.count("W")result = []we = w - esn = s - nif we > 0result.push weelsif we < 0result.push we.absendif sn > 0result.push snelsif sn < 0result.push sn.absendp 0 if result.empty?p Math.hypot(result[0], result[1]) unless result.empty?