結果

問題 No.113 宝探し
ユーザー kotatsugame
提出日時 2016-12-21 16:41:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 277 bytes
コンパイル時間 1,313 ms
コンパイル使用メモリ 166,928 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 21:29:41
合計ジャッジ時間 2,074 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;cin>>s;
	int u=0,l=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='N')u++;
		else if(s[i]=='E')l++;
		else if(s[i]=='S')u--;
		else l--;
	}
	cout<<fixed<<setprecision(12)<<sqrt(pow(abs(u),2)+pow(abs(l),2))<<endl;
}
0