結果
問題 | No.113 宝探し |
ユーザー | koyumeishi |
提出日時 | 2015-01-15 23:51:27 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 678 ms |
コンパイル使用メモリ | 74,180 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 20:39:11 |
合計ジャッジ時間 | 1,330 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> using namespace std; 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++; else if(S[i] == 'E') x++; else if(S[i] == 'W') x--; else if(S[i] == 'S') y--; } printf("%.5f\n", sqrt(x*x + y*y)); return 0; }