結果

問題 No.113 宝探し
ユーザー トミー
提出日時 2024-04-03 22:14:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 487 bytes
コンパイル時間 1,686 ms
コンパイル使用メモリ 167,224 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-01 00:07:34
合計ジャッジ時間 2,439 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll=vector<long long>;
template<typename T>
T get(){T r;cin>>r;return r;}

int main() {
    string s=get<string>();
    ll x=0,y=0;
    for(ll i=0;i!=s.size();i++){
        if(s[i]=='N'){
            y++;
        }else if(s[i]=='S'){
            y--;
        }else if(s[i]=='E'){
            x++;
        }else{
            x--;
        }
    }
    cout<<pow(pow(x,2)+pow(y,2),0.5)<<endl;

    system("pause");
}
0