結果

問題 No.1134 Deviation Score Ⅱ
ユーザー scrappyscrappy
提出日時 2022-10-13 15:46:13
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 837 bytes
コンパイル時間 11,939 ms
コンパイル使用メモリ 213,888 KB
実行使用メモリ 5,560 KB
最終ジャッジ日時 2023-09-08 19:07:09
合計ジャッジ時間 14,141 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
5,536 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,384 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 3 ms
5,544 KB
testcase_12 WA -
testcase_13 AC 4 ms
5,556 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 3 ms
5,544 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 4 ms
5,552 KB
testcase_22 AC 3 ms
5,548 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
4,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.1134 Deviation Score Ⅱ
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 100000*7+2), 100000*7+2)
	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	ss := strings.Fields(sc.Text())
	x := make([]int, N)
	for i := 0; i < N; i++ {
		x[i], _ = strconv.Atoi(ss[i])
	}

	sc.Scan()
	M, _ := strconv.Atoi(sc.Text())

	sum := 0
	for i := 0; i < N; i++ {
		sum += x[i]
	}
	ave := float64(sum) / float64(N)

	aa := 0.0
	for i := 0; i < N; i++ {
		a := float64(x[i]) - ave
		aa += a * a
	}
	aa = math.Sqrt(aa / float64(N))
	if aa == 0 {
		fmt.Println(50)
	} else {
		bb := (float64(x[M-1]) - ave) * 10.0 / aa
		if float64(x[M-1]) >= ave {
			fmt.Println(math.Floor(50.0 + bb))
		} else {
			fmt.Println(math.Floor(50.0 - bb))
		}
	}
}
0