結果

問題 No.851 テストケース
ユーザー kat0rikkat0rik
提出日時 2020-01-10 13:41:06
言語 Go
(1.21.3)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 644 bytes
コンパイル時間 11,355 ms
コンパイル使用メモリ 210,108 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-15 14:25:18
合計ジャッジ時間 12,365 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

package main

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

func nextLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var N int
	fmt.Scan(&N)
	sc := bufio.NewScanner(os.Stdin)
	a := make([]int, 0)
	for i := 0; i < N; i++ {
		ss := strings.Split(nextLine(sc), " ")
		if len(ss) != 1 {
			fmt.Println("\"assert\"")
			return
		}
		v, _ := strconv.Atoi(ss[0])
		a = append(a, v)
	}
	b := make([]int, 0)
	b = append(b, a[0]+a[1])
	b = append(b, a[0]+a[2])
	b = append(b, a[1]+a[2])
	sort.Sort(sort.Reverse(sort.IntSlice(b)))
	if b[0] == b[1] {
		fmt.Println(b[2])
	} else {
		fmt.Println(b[1])
	}
}
0