結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-08-04 23:01:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 812 bytes |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 74,108 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 20:58:06 |
| 合計ジャッジ時間 | 1,285 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000000009
#define INF 10000000
#define LLINF 2000000000000000000LL
#define SIZE 101
int main(){
string S;
int x=0,y=0;
cin >> S;
for(int i=0;i<S.size();i++)
{
switch (S[i]) {
case 'N':
y++;
break;
case 'W':
x++;
break;
case 'S':
y--;
break;
case 'E':
x--;
}
}
printf("%.5lf\n",sqrt((double)(x*x+y*y)));
return 0;
}
goodbaton