結果

問題 No.851 テストケース
ユーザー kat0rikkat0rik
提出日時 2020-01-10 13:39:48
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 11,911 ms
コンパイル使用メモリ 225,424 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 01:49:04
合計ジャッジ時間 12,775 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 WA -
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 1 ms
6,940 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