結果

問題 No.113 宝探し
ユーザー yukirin
提出日時 2015-05-12 14:45:46
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 331 bytes
コンパイル時間 12,835 ms
コンパイル使用メモリ 219,708 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 20:54:03
合計ジャッジ時間 13,038 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	var x, y float64

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	for _, d := range scanner.Text() {
		switch d {
		case 'N':
			y++
		case 'E':
			x++
		case 'W':
			x--
		case 'S':
			y--
		}
	}

	fmt.Println(math.Hypot(math.Abs(x), math.Abs(y)))
}
0