結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-14 20:27:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 295 bytes |
| コンパイル時間 | 1,565 ms |
| コンパイル使用メモリ | 166,148 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-20 00:53:44 |
| 合計ジャッジ時間 | 2,533 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int x = 0, y = 0;
for (const auto &p : s) {
if (p == 'N') ++y;
else if (p == 'E') ++x;
else if (p == 'W') --x;
else if (p == 'S') --y;
}
printf("%f\n", sqrt(x * x + y * y));
return 0;
}