結果
問題 | No.113 宝探し |
ユーザー |
![]() |
提出日時 | 2020-05-06 02:16:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 331 bytes |
コンパイル時間 | 2,065 ms |
コンパイル使用メモリ | 168,104 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 13:31:00 |
合計ジャッジ時間 | 2,973 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int x = 0, y = 0; for (int i = 0; i < s.size(); i++) { char c = s.at(i); if (c == 'N') y++; if (c == 'E') x++; if (c == 'W') x--; if (c == 'S') y--; } x *= x; y *= y; int sum = x + y; double a = sqrt(sum); cout << a << endl; }