結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
zaichu
|
| 提出日時 | 2015-12-23 03:24:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 395 bytes |
| コンパイル時間 | 1,357 ms |
| コンパイル使用メモリ | 161,868 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 21:05:30 |
| 合計ジャッジ時間 | 2,099 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
string str;
cin >> str;
sort(str.begin(),str.end());
int e = 0,n = 0,s = 0,w = 0;
for(int i = 0; i < str.size(); i++){
if(str[i] == 'E') e++;
if(str[i] == 'N') n++;
if(str[i] == 'S') s++;
if(str[i] == 'W') w++;
}
double tate = abs(n-s);
double yoko = abs(e-w);
cout << sqrt(tate*tate + yoko*yoko) << endl;
return 0;
}
zaichu