結果
| 問題 | 
                            No.113 宝探し
                             | 
                    
| コンテスト | |
| ユーザー | 
                             leaf+
                         | 
                    
| 提出日時 | 2019-04-14 18:14:00 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 383 bytes | 
| コンパイル時間 | 894 ms | 
| コンパイル使用メモリ | 60,128 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-16 22:03:30 | 
| 合計ジャッジ時間 | 1,324 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 23 | 
ソースコード
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main() {
    string s;
    int i, n = 0, e = 0;
    cin >> s;
    for (i = 0; i < s.length(); i++) {
        if (s[i] == 'N') {n += 1;}
        if (s[i] == 'E') {e += 1;}
        if (s[i] == 'W') {e -= 1;}
        if (s[i] == 'S') {n -= 1;}
    }
    cout << sqrt(n * n + e * e) << endl;
    return 0;
}
            
            
            
        
            
leaf+