結果
| 問題 | No.113 宝探し |
| コンテスト | |
| ユーザー |
r2en_
|
| 提出日時 | 2017-07-11 11:05:05 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 423 bytes |
| 記録 | |
| コンパイル時間 | 547 ms |
| コンパイル使用メモリ | 81,732 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-12 02:54:09 |
| 合計ジャッジ時間 | 2,009 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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_