結果

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

ソースコード

diff #

#include <cstdio>
#include <cmath>
#include <string>
#include <iostream>

using namespace std;

int main(){
  int n = 0, e = 0;
  string str;
  cin >> str;
  for(int i = 0; i < str.size(); i++){
    switch(str[i]){
    case 'N':
      n++;
      break;
    case 'E':
      e++;
      break;
    case 'W':
      e--;
      break;
    case 'S':
      n--;
      break;
    }
  }
  printf("%f\n", sqrt(n * n + e * e));
  return 0;
}
0