結果

問題 No.2110 012 Matching
ユーザー tentententen
提出日時 2022-10-31 12:40:27
言語 Java19
(openjdk 21)
結果
AC  
実行時間 438 ms / 2,000 ms
コード長 1,494 bytes
コンパイル時間 2,921 ms
コンパイル使用メモリ 74,256 KB
実行使用メモリ 63,220 KB
最終ジャッジ日時 2023-09-22 10:07:57
合計ジャッジ時間 7,850 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,380 KB
testcase_01 AC 248 ms
55,932 KB
testcase_02 AC 370 ms
62,776 KB
testcase_03 AC 341 ms
59,972 KB
testcase_04 AC 419 ms
62,708 KB
testcase_05 AC 362 ms
62,824 KB
testcase_06 AC 356 ms
60,444 KB
testcase_07 AC 438 ms
62,468 KB
testcase_08 AC 132 ms
52,924 KB
testcase_09 AC 200 ms
53,876 KB
testcase_10 AC 421 ms
63,220 KB
testcase_11 AC 42 ms
49,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (n-- > 0) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            long c = sc.nextLong();
            long ans = 0;
            if (a <= c) {
                ans += a * 2;
                c -= a;
                ans += c / 2;
                ans += b / 2 * 2;
            } else {
                ans += c * 2;
                ans += b / 2 * 2;
                ans += b % 2;
            }
            sb.append(ans).append("\n");
        }
        System.out.print(sb);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0