結果

問題 No.113 宝探し
ユーザー LV3zJigVW57oPGy
提出日時 2022-11-18 13:46:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 334 bytes
コンパイル時間 1,172 ms
コンパイル使用メモリ 159,368 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 20:30:31
合計ジャッジ時間 2,153 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std;

int main(){
  string a;
  cin >> a;
  int count1=0;
  int count2=0;
  for(int i=0;i<a.size();i++){
    if(a.at(i)=='N')count1++;
    else if(a.at(i)=='S')count1--;
    else if(a.at(i)=='E')count2++;
    else if(a.at(i)=='W')count2--;
  }
  cout << sqrt(pow(count1, 2)+pow(count2, 2));
}
0