結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
kekenx
|
| 提出日時 | 2020-03-06 13:04:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 383 bytes |
| コンパイル時間 | 1,575 ms |
| コンパイル使用メモリ | 166,148 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 22:28:13 |
| 合計ジャッジ時間 | 2,475 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
double x = 0, y = 0;
int n = s.size();
for (int i = 0; i < n; ++i) {
if (s[i] == 'N') y += 1;
if (s[i] == 'S') y -= 1;
if (s[i] == 'W') x -= 1;
if (s[i] == 'E') x += 1;
}
double ans = sqrt(x * x + y * y);
cout << fixed << setprecision(10) << ans << '\n';
return 0;
}
kekenx