結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2016-02-26 20:52:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 1,660 ms |
コンパイル使用メモリ | 159,672 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 21:10:23 |
合計ジャッジ時間 | 1,953 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> #define rep(i,l,n) for(int i=l;i<n;i++) #define rer(i,l,n) for(int i=l;i<=n;i++) #define all(a) a.begin(),a.end() #define o(a) cout<<a<<endl using namespace std; typedef long long lint; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; int main(){ string s; cin>>s; double x=0,y=0; rep(i,0,s.size()){ if(s[i]=='N') y++; if(s[i]=='E') x++; if(s[i]=='W') x--; if(s[i]=='S') y--; } double ans; ans=sqrt(x*x+y*y); printf("%.6lf\n",ans); }