結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2015-01-08 08:45:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 816 ms |
コンパイル使用メモリ | 80,236 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 20:38:44 |
合計ジャッジ時間 | 1,294 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <vector> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <functional> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <cctype> #include <string> using namespace std; int dir['z'+1]; int main() { dir['N'] = 0; dir['W'] = 1; dir['S'] = 2; dir['E'] = 3; string str; cin >> str; int dx[] = {0, 1, 0, -1}; int dy[] = {-1, 0, 1, 0}; int px, py; px = py = 0; for (int i = 0; i < str.size(); i++) { int p = dir[str[i]]; px += dx[p]; py += dy[p]; } cout << fixed << setprecision(5) << hypot(double(px), double(py)) << endl; }