結果
問題 | No.113 宝探し |
ユーザー |
![]() |
提出日時 | 2014-12-29 00:03:26 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 84 ms / 5,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-11-16 20:36:14 |
合計ジャッジ時間 | 3,363 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
コンパイルメッセージ
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] ||= 0) unless result.empty?