結果

問題 No.113 宝探し
ユーザー KuraKura
提出日時 2019-02-22 08:21:28
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 60,124 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 16:34:34
合計ジャッジ時間 1,623 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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<<sqrt(a*a+b*b)<<endl;
}
0