結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2016-10-06 22:21:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 601 ms |
コンパイル使用メモリ | 73,640 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 21:27:41 |
合計ジャッジ時間 | 1,353 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<vector> #include<map> #include<queue> #include<string> #include<sstream> #include<cmath> using namespace std; int main(){ string s; cin >> s; int x = 0, y = 0; for(int i=0; i<s.size(); i++){ if( s[i] == 'N' ) y++; else if( s[i] == 'S' ) y--; else if( s[i] == 'W' ) x--; else if( s[i] == 'E' ) x++; } printf("%.5lf", sqrt(x*x + y*y)); return 0; }