結果

問題 No.394 ハーフパイプ(1)
ユーザー 💕💖💞💕💖💞
提出日時 2016-09-09 14:42:32
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 10,031 ms
コンパイル使用メモリ 242,092 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 22:31:54
合計ジャッジ時間 10,531 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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


func main() {
	scanner := bufio.NewScanner(os.Stdin)
	th := 0
	tgt := []float64{}
	for scanner.Scan() {
	  th += 1
		text := scanner.Text()
		if text == "" { break }
		for _, t := range strings.Split(text, " ") {
		  n, _ := strconv.ParseFloat(t, 64) 
		  tgt = append(tgt, n)
	  }
		if th == 1 { break }
	}
	sort.Float64s(tgt)
	next := make([]float64, len(tgt))
	copy(next, tgt)
	next = next[1:len(next)-1]
	sum := 0.
	for _, n := range next {
	  sum += n
	}
	fmt.Printf("%2.2f", sum/float64(len(next)) )
	fmt.Println()
	//fmt.Println(next)
}
0