結果
問題 |
No.113 宝探し
|
ユーザー |
|
提出日時 | 2019-11-20 11:25:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 373 bytes |
コンパイル時間 | 1,346 ms |
コンパイル使用メモリ | 81,752 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 22:17:44 |
合計ジャッジ時間 | 1,930 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <map> #include <math.h> using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int x=0,y=0; string s; cin >> s; for(char c:s){ if(c=='N')x++; if(c=='S')x--; if(c=='W')y++; if(c=='E')y--; } cout << sqrt(x*x+y*y) << endl; }