結果

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

ソースコード

diff #

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

using namespace std;

int main(){

	int NS=0,EW=0;
	string S;

	cin>>S;
	for(int i=0;i<S.size();i++){
		if(S[i]=='N') NS++;
		if(S[i]=='W') EW++;
		if(S[i]=='S') NS--;
		if(S[i]=='E') EW--;
	}

	printf("%.12f",sqrt((double)NS*NS+EW*EW));
}
0