結果

問題 No.2110 012 Matching
ユーザー bluemegane
提出日時 2022-10-29 07:33:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 649 ms / 2,000 ms
コード長 800 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 114,944 KB
実行使用メモリ 31,904 KB
最終ジャッジ日時 2024-07-06 08:16:19
合計ジャッジ時間 6,742 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var t = int.Parse(Console.ReadLine().Trim());
        while (t-- > 0)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = long.Parse(line[0]);
            var b = long.Parse(line[1]);
            var c = long.Parse(line[2]);
            getAns(a, b, c);
        }
    }
    static void getAns(long a, long b, long c)
    {
        var ans = 0L;
        var acmin = Min(a, c);
        a -= acmin;
        c -= acmin;
        ans += acmin * 2L;
        ans += (b / 2) * 2L;
        b %= 2;
        var abmin = Min(a, b);
        ans += abmin;
        ans += c / 2L;
        Console.WriteLine(ans);
    }
}
0