結果
問題 | No.113 宝探し |
ユーザー | machy |
提出日時 | 2015-06-11 12:46:08 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 544 ms |
コンパイル使用メモリ | 73,028 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 20:57:23 |
合計ジャッジ時間 | 1,327 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cmath> #include <iomanip> using namespace std; typedef long long LL; int main(){ string s; cin >> s; int x = 0; int y = 0; for(int i = 0; i < s.size(); i++){ if(s[i] == 'N') y -= 1; if(s[i] == 'E') x += 1; if(s[i] == 'W') x -= 1; if(s[i] == 'S') y += 1; } cout << setprecision(13) << sqrt(x*x + y*y) << endl; return 0; }