結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
r2en_
|
| 提出日時 | 2017-07-11 11:05:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 423 bytes |
| コンパイル時間 | 593 ms |
| コンパイル使用メモリ | 68,608 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 21:35:05 |
| 合計ジャッジ時間 | 1,357 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
int main(){
string s; cin >> s;
int x = 0; int y = 0;
int n; n = s.size();
rep(i,n){
if(s[i]=='N'){ y+=1; }
else if(s[i]=='W'){ x+=1; }
else if(s[i]=='E'){ x-=1; }
else if(s[i]=='S'){ y-=1; }
}
cout << sqrt(pow(abs(x),2) + pow(abs(y),2)) << endl;
return 0;
}
r2en_