結果

問題 No.113 宝探し
ユーザー 61washingmachine61washingmachine
提出日時 2014-12-29 23:57:48
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 494 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 62,140 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 20:38:11
合計ジャッジ時間 1,530 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

//washing_machine61

#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;

int main(){
  string x;
  double distns = 0.0;
  double distew = 0.0;
  cin >> x;
  for(int i =0; i < x.size(); i++){
    if(x[i] == 'N'){
      distns += 1.0;
    }
    if(x[i] == 'S'){
      distns -= 1.0;
    }
    if(x[i] == 'E'){
      distew += 1.0;
    }
    if(x[i] == 'W'){
      distew -= 1.0;
    }
   }	
    cout << sqrt(distns*distns + distew*distew) << '\n';
  
}
0