結果
問題 |
No.113 宝探し
|
ユーザー |
|
提出日時 | 2017-02-28 21:05:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 741 bytes |
コンパイル時間 | 624 ms |
コンパイル使用メモリ | 67,584 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 21:31:06 |
合計ジャッジ時間 | 1,426 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <iostream> #include <string> #include <math.h> #include <iomanip> using namespace std; int main(){ string str; cin >> str; int y = 0; int x = 0; double ans; for(int d = 0; d < str.length(); d++){ switch(str[d]){ case 'N': y++; break; case 'W': x--; break; case 'E': x++; break; case 'S': y--; break; } } // cout << "x:" << x << " y:" << y << "x^2+y^2:" << x*x+y*y << endl; ans = sqrt(x*x+y*y); // cout <<"test:" << 1000*sqrt(x*x+y*y) << endl; cout << fixed << ans << endl; return 0; }