結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-29 20:28:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 409 bytes |
| コンパイル時間 | 2,983 ms |
| コンパイル使用メモリ | 94,724 KB |
| 最終ジャッジ日時 | 2025-01-09 10:52:10 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}