結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
mannshi222
|
| 提出日時 | 2022-04-28 20:11:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 390 bytes |
| コンパイル時間 | 988 ms |
| コンパイル使用メモリ | 93,260 KB |
| 最終ジャッジ日時 | 2025-01-28 22:12:43 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
vector<int> cnt(26, 0);
string S;
cin >> S;
for( int i = 0; i < S.size(); i++ ) {
cnt[S[i]-'A'] ++;
}
double x, y;
x = abs( cnt['N'-'A'] - cnt['S'-'A'] );
y = abs( cnt['W'-'A'] - cnt['E'-'A'] );
cout << sqrt( x * x + y * y ) << endl;
return 0;
}
mannshi222