結果

問題 No.113 宝探し
ユーザー aaaaaaiu
提出日時 2019-07-26 16:02:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 319 bytes
コンパイル時間 1,972 ms
コンパイル使用メモリ 194,316 KB
最終ジャッジ日時 2025-01-07 07:35:16
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    string s; cin >> s;
    int y, x;
    y=x=0;
    for (char c : s) {
        if (c == 'N') y++;
        else if (c == 'E') x++;
        else if (c == 'W') x--;
        else y--;
    }
    cout << sqrt(y*y+x*x) << endl;
    return 0;
}
0