結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
koyopro
|
| 提出日時 | 2015-10-03 18:05:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 1,324 ms |
| コンパイル使用メモリ | 159,076 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 21:00:13 |
| 合計ジャッジ時間 | 2,113 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(int i=0; i<(n); i++)
struct P { int x, y; P(){}; P(int _x, int _y): x(_x), y(_y){}; };
signed main()
{
string s;
cin >> s;
P p = P(0,0);
for (auto&& t : s) {
if (t == 'N') p.y++;
if (t == 'S') p.y--;
if (t == 'W') p.x++;
if (t == 'E') p.x--;
}
printf("%.14f\n", sqrt(pow(p.x,2) + pow(p.y,2)));
return 0;
}
koyopro