結果
| 問題 | 
                            No.113 宝探し
                             | 
                    
| コンテスト | |
| ユーザー | 
                             focus
                         | 
                    
| 提出日時 | 2018-01-23 22:43:49 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 400 bytes | 
| コンパイル時間 | 626 ms | 
| コンパイル使用メモリ | 64,888 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-16 21:46:43 | 
| 合計ジャッジ時間 | 1,397 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 23 | 
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    string str;
    int x=0,y=0;
    cin >> str;
    for(int i=0;str[i]!='\0';i++){
        if(str[i]=='N') x++;
        else if(str[i]=='S')    x--;
        else if(str[i]=='E')    y++;
        else if(str[i]=='W')    y--;    
    }
    cout << sqrt(x*x+y*y);
    return 0;
}
            
            
            
        
            
focus