結果

問題 No.113 宝探し
ユーザー subsn
提出日時 2023-06-23 09:39:16
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 269 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 14:51:48
合計ジャッジ時間 1,172 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include <math.h>
int main() {
	char s[105];
	int e = 0, n = 0;
	scanf("%s", s);

	for (int i=0;s[i];i++){
		s[i]=='N'?n++:n;
		s[i]=='E'?e++:e;
		s[i]=='W'?e--:e;
		s[i]=='S'?n--:n;
	}
	printf("%lf", (double)sqrt(e * e + n * n));
}
0