結果

問題 No.2110 012 Matching
ユーザー scrappyscrappy
提出日時 2022-10-28 21:59:50
言語 Go
(1.22.1)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 15,663 ms
コンパイル使用メモリ 212,472 KB
実行使用メモリ 8,152 KB
最終ジャッジ日時 2023-09-20 04:56:10
合計ジャッジ時間 16,731 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 14 ms
5,560 KB
testcase_02 AC 34 ms
7,928 KB
testcase_03 AC 24 ms
7,912 KB
testcase_04 AC 44 ms
8,064 KB
testcase_05 AC 31 ms
7,908 KB
testcase_06 AC 31 ms
7,908 KB
testcase_07 AC 50 ms
8,152 KB
testcase_08 AC 3 ms
4,356 KB
testcase_09 AC 8 ms
5,516 KB
testcase_10 AC 50 ms
8,148 KB
testcase_11 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.2110 012 Matching
package main

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

func min(a, b int) int {
	if a <= b {
		return a
	} else {
		return b
	}
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	T, _ := strconv.Atoi(sc.Text())

	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	for i := 0; i < T; i++ {
		sc.Scan()
		ss := strings.Split(sc.Text(), " ")
		A, _ := strconv.Atoi(ss[0])
		B, _ := strconv.Atoi(ss[1])
		C, _ := strconv.Atoi(ss[2])

		point := 0
		p02 := min(A, C)
		point += 2 * p02
		A -= p02
		C -= p02

		p11 := B / 2
		point += 2 * p11
		B -= 2 * p11

		p22 := C / 2
		point += 1 * p22

		p01 := min(A, B)
		point += 1 * p01

		fmt.Fprintln(wr, point)
	}
}
0