結果

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

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  char input='\0';
  int x=0, y=0;

  while(input!='\n'){
    cin.get(input);
    switch(input){
    case 'N': ++y; break;
    case 'E': --x; break;
    case 'W': ++x; break;
    case 'S': --y; break;
    }
  }
  cout << sqrt(x*x+y*y) << "\n";

  return 0;
}
0