結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
chiyoda
|
| 提出日時 | 2016-06-29 23:45:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 633 bytes |
| コンパイル時間 | 662 ms |
| コンパイル使用メモリ | 72,088 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 21:16:15 |
| 合計ジャッジ時間 | 1,468 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ll long long
#define ull unsigned long long
#define pb(x) push_back(x)
using namespace std;
int main() {
string s;
cin >> s;
int x = 0, y = 0;
rep(i, s.size()) {
switch (s[i]) {
case 'N': y++; break;
case 'E': x++; break;
case 'S': y--; break;
case 'W': x--; break;
}
}
double res = sqrt(x * x + y * y);
printf("%.2f\n", res);
return 0;
}
chiyoda