結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2015-11-01 19:38:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 439 bytes |
コンパイル時間 | 759 ms |
コンパイル使用メモリ | 66,036 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 21:00:42 |
合計ジャッジ時間 | 1,220 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include<iostream> #include<stdio.h> #include<vector> #include<algorithm> #include<math.h> using namespace std; int main(){ string str; cin>> str; int n=0, e=0, w=0, s=0; for(int i=0; i<str.size(); i++){ if(str[i]=='N')n++; else if(str[i]=='E')e++; else if(str[i]=='W')w++; else s++; } double ans = sqrt((double)(n-s)*(n-s)+(e-w)*(e-w)); printf("%f\n", ans); return 0; }