結果

問題 No.113 宝探し
ユーザー magmag
提出日時 2020-06-14 14:41:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,535 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 164,580 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 16:39:30
合計ジャッジ時間 3,151 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
	//繝サ縲君縲阪・蛹励↓1繝。繝シ繝医Ν遘サ蜍輔☆繧九€・
	//繝サ縲窪縲阪・譚ア縺ォ1繝。繝シ繝医Ν遘サ蜍輔☆繧九€・
	//繝サ縲係縲阪・隘ソ縺ォ1繝。繝シ繝医Ν遘サ蜍輔☆繧具ス。
	//繝サ縲郡縲阪・蜊励↓1繝。繝シ繝医Ν遘サ蜍輔☆繧九€・
	//縺昴・蝨ー轤ケ繧呈侍繧後・螳昴′蜃コ縺ヲ縺上k繧医≧縺ァ縺吶€・
	//縺励°縺励€、蜷帙・遘サ蜍墓婿豕輔・辟。鬧・↓豌励▼縺阪∪縺励◆縲・
	//縲君E縲阪〒縺ゅl縺ー蛹玲擲縺ョ譁ケ蜷代↓
	//竏・2+12=竏・
	//繝。繝シ繝医Ν縺縺醍ァサ蜍輔☆繧後・濶ッ縺輔◎縺・〒縺吶€・
	//A蜷帙・蜈ャ蝨偵・荳ュ蠢・°繧画怙遏ュ縺ョ霍晞屬縺ァ螳昴′蝓九∪縺」縺ヲ縺・k菴咲スョ縺ォ遘サ蜍輔@縺溘>縺ァ縺吶€・
	//髫懷ョウ迚ゥ縺ォ縺カ縺、縺九k蜿ッ閭ス諤ァ縺ッ辟。縺・→縺励※縲、蜷帙・菴輔Γ繝シ繝医Ν遘サ蜍・
	string s;cin>>s;
  double x=0,y=0;
  rep(i,s.size()){
		switch (s[i]){
			case 'N':
        y++;
				break;
			case 'E':
        x++;
				break;
			case 'W':
        x--;
				break;
			default:
        y--;
    }
  }
  cout<<sqrt(x*x+y*y)<<endl;
}
0