結果

問題 No.113 宝探し
ユーザー Kura
提出日時 2019-02-22 08:21:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 60,988 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-22 16:35:16
合計ジャッジ時間 1,467 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 12 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main(){
    int a=0;int b=0;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='N'){
            a++;
        }else if(s[i]=='E'){
            b++;
        }else if(s[i]=='W'){
            a--;
        }else if(s[i]=='S'){
            b--;
        }
    }
    cout<<fixed<<sqrt(a*a+b*b)<<endl;
}
0