結果

問題 No.113 宝探し
ユーザー re1ns
提出日時 2015-11-08 13:09:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 60,760 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 21:00:47
合計ジャッジ時間 1,207 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;
int main(){
    string str;
    double ans;
    int n=0,e=0,w=0,s=0;
    cin >> str;
    for(int i=0;i<str.length();i++){
        switch(str[i]){
            case 'N':n++;break;
            case 'E':e++;break;
            case 'W':w++;break;
            case 'S':s++;break;
        }
    }
    ans = sqrt(pow(n-s,2)+pow(e-w,2));
    cout << ans << endl;
}
0