結果
問題 | No.394 ハーフパイプ(1) |
ユーザー |
![]() |
提出日時 | 2016-09-09 14:42:32 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 11,470 ms |
コンパイル使用メモリ | 221,884 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-16 05:23:40 |
合計ジャッジ時間 | 12,030 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
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) }