結果
問題 | No.113 宝探し |
ユーザー |
![]() |
提出日時 | 2019-01-07 00:07:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 370 bytes |
コンパイル時間 | 628 ms |
コンパイル使用メモリ | 68,992 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 22:00:23 |
合計ジャッジ時間 | 1,399 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <iostream> #include <string> #include <math.h> using namespace std; int main() { string S; cin >> S; int x = 0; int y = 0; for (char c : S) { int i = 0; for (char news : "NESW") { if (c == news) { int sgn = i < 2 ? 1 : -1; x += sgn * (i % 2); y += sgn * ((i + 1) % 2); } i++; } } cout << sqrt(x * x + y * y) << endl; }