結果

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

ソースコード

diff #

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

using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)

int main()
{
	int x = 0, y = 0;
	string str;
	cin >> str;

	REP(i, str.size()) {
		switch (str[i])
		{
		case 'E': x++; break;
		case 'W': x--; break;
		case 'N': y++; break;
		default: y--; break;
		}
	}
	cout << sqrt(x * x + y * y) << endl;

	return 0;
}
0