結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2018-02-28 22:42:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 722 bytes |
コンパイル時間 | 644 ms |
コンパイル使用メモリ | 74,236 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 21:47:45 |
合計ジャッジ時間 | 1,531 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
// No.113 宝探し // https://yukicoder.me/problems/no/113 // #include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; double solve(string &S); int main() { string S; cin >> S; double ans = solve(S); cout << fixed << setprecision(5) << ans << endl; } double solve(string &S) { int x = 0; int y = 0; for (char s: S) { switch (s) { case 'N': y--; break; case 'E': x++; break; case 'W': x--; break; case 'S': y++; break; } } return sqrt(x*x + y*y); }