結果

問題 No.512 魔法少女の追いかけっこ
ユーザー shirot7335
提出日時 2017-05-06 21:13:43
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 897 bytes
コンパイル時間 14,288 ms
コンパイル使用メモリ 225,320 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 06:21:22
合計ジャッジ時間 14,043 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func convH2S(speedH float64) float64 {
	return speedH / 60 / 60 / 1000
}

func judgeCandR(sections []float64, xs, ys float64) bool {
	for i := 0; i < len(sections)-2; i++ {
		kobaS := sections[i] / xs
		if ys*kobaS > sections[i+1] {
			return false
		}
	}
	return true
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	speed := strings.Fields(scanner.Text())
	x, _ := strconv.ParseFloat(speed[0], 32)
	y, _ := strconv.ParseFloat(speed[1], 32)

	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())

	scanner.Scan()
	sections := strings.Fields(scanner.Text())

	a := make([]float64, 0, n)
	for _, val := range sections {
		val, _ := strconv.ParseFloat(val, 32)
		a = append(a, val)
	}

	xs, ys := convH2S(x), convH2S(y)
	if judgeCandR(a, xs, ys) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0