結果
| 問題 | No.113 宝探し |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-29 20:28:28 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 409 bytes |
| 記録 | |
| コンパイル時間 | 624 ms |
| コンパイル使用メモリ | 112,104 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-09 05:03:48 |
| 合計ジャッジ時間 | 1,929 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#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;
}