結果
| 問題 | 
                            No.113 宝探し
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-04-22 21:47:45 | 
| 言語 | Python2  (2.7.18)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 14 ms / 5,000 ms | 
| コード長 | 321 bytes | 
| コンパイル時間 | 224 ms | 
| コンパイル使用メモリ | 6,912 KB | 
| 実行使用メモリ | 6,784 KB | 
| 最終ジャッジ日時 | 2024-11-16 20:50:39 | 
| 合計ジャッジ時間 | 1,380 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 23 | 
ソースコード
#!/usr/bin/python
from collections import Counter
dic = {
    'N': (0, 1),
    'E': (1, 0),
    'W': (-1, 0),
    'S': (0, -1),
}
calc_distance = lambda k: map(lambda v: v*counter[k], dic[k])
S = raw_input()
counter = Counter(S)
arr = map(calc_distance, counter.keys())
x, y = map(sum, zip(*arr))
print (x*x + y*y) ** .5