結果

問題 No.549 素材合成システム
ユーザー tsuchinaga
提出日時 2019-03-15 17:05:11
言語 Go
(1.23.4)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 12,024 ms
コンパイル使用メモリ 221,524 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-07-01 20:01:18
合計ジャッジ時間 14,323 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	var n, a int
	_, _ = fmt.Scan(&n, &a)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	max := a
	e := make([]int, 0)
	for i := 1; i < n; i++ {
		sc.Scan()
		a, _ = strconv.Atoi(sc.Text())

		if max < a {
			e = append(e, max)
			max = a
		} else {
			e = append(e, a)
		}
	}

	for _, exp := range e {
		max += exp / 2
	}
	fmt.Println(max)
}
0