結果
問題 |
No.113 宝探し
|
ユーザー |
|
提出日時 | 2023-01-04 11:54:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 1,615 ms |
コンパイル使用メモリ | 167,116 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 14:14:44 |
合計ジャッジ時間 | 2,510 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin>>S; vector<int> l(2,0); for(int i=0;i<S.size();i++){ if(S[i]=='N'){ l[1]++; } else if(S[i]=='S'){ l[1]--; } else if(S[i]=='E'){ l[0]++; } else if(S[i]=='W'){ l[0]--; } } cout<<(double)sqrt(l[0]*l[0]+l[1]*l[1])<<endl; }