結果

問題 No.113 宝探し
ユーザー Mcpu3
提出日時 2018-06-22 15:52:15
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 271 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 31,488 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 21:57:09
合計ジャッジ時間 1,177 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void)
{
	char s[101];
	int i,x=0,y=0;
	scanf("%s",s);
	for(i=0;i<strlen(s);i++){
		if(s[i]=='N')y++;
		else if(s[i]=='S')y--;
		else if(s[i]=='E')x++;
		else x--;
	}
	printf("%f",hypot(x,y));
	return 0;
}
0