結果

問題 No.113 宝探し
コンテスト
ユーザー tonyu0
提出日時 2020-03-29 20:28:28
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 625µs
コード長 409 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 629 ms
コンパイル使用メモリ 112,096 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-10-25 17:27:13
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using ll = long long;
using namespace std;
constexpr ll INF = 1LL << 60;

string s;

int main() {
	cin >> s;
	int x = 0, y = 0;
	for (char c : s) {
		if (c == 'N') ++y;
		if (c == 'E') ++x;
		if (c == 'W') --x;
		if (c == 'S') --y;
	}
	cout << fixed << setprecision(10) << sqrt(x * x + y * y) << endl;
	return 0;
}
0