結果

問題 No.113 宝探し
ユーザー greentea011
提出日時 2019-04-11 14:51:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 317 bytes
コンパイル時間 544 ms
コンパイル使用メモリ 68,224 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 22:02:58
合計ジャッジ時間 1,295 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>
int main() {
    float x=0,y=0;
    std::string s;
    std::cin>>s;
    for(auto& c:s) {
             if (c=='N')y+=1;
        else if (c=='E')x+=1;
        else if (c=='S')y-=1;
        else if (c=='W')x-=1;
    }
    std::cout<<std::sqrt(x*x+y*y)<<std::endl;
}
0