結果

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>

using namespace std;

int main() {
	string s;

	cin >> s;
	vector<int> vec(26, 0);

	for (int i = 0; i < s.size(); i++) {
		vec[s[i] - 'A']++;
	}

	double ans = pow(vec['N' - 'A'] - vec['S' - 'A'], 2) +
	             pow(vec['E' - 'A'] - vec['W' - 'A'], 2);
	ans = sqrt(ans);
	cout << ans << endl;
	return 0;
}
0