結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2017-11-22 04:41:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 490 bytes |
コンパイル時間 | 744 ms |
コンパイル使用メモリ | 85,604 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 21:40:15 |
合計ジャッジ時間 | 1,561 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cmath> #include<math.h> #include<iomanip> #include<stdio.h> #include<random> #include<ctime> #include<cstdlib> using namespace std; int main(){ string s; double ans, x=0, y=0; cin >> s; 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 { y--; } } ans=sqrt(x*x+y*y); cout << ans << endl; return 0; }