結果

問題 No.920 あかあお
ユーザー tentententen
提出日時 2020-11-12 18:30:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 663 bytes
コンパイル時間 2,054 ms
コンパイル使用メモリ 71,932 KB
実行使用メモリ 56,040 KB
最終ジャッジ日時 2023-09-30 01:44:59
合計ジャッジ時間 5,052 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,728 KB
testcase_01 AC 126 ms
56,040 KB
testcase_02 AC 125 ms
55,812 KB
testcase_03 AC 125 ms
54,024 KB
testcase_04 AC 127 ms
55,748 KB
testcase_05 AC 124 ms
55,480 KB
testcase_06 AC 124 ms
55,908 KB
testcase_07 AC 124 ms
55,496 KB
testcase_08 AC 125 ms
55,816 KB
testcase_09 AC 125 ms
55,976 KB
testcase_10 AC 128 ms
55,524 KB
testcase_11 AC 123 ms
55,688 KB
testcase_12 AC 123 ms
55,820 KB
testcase_13 AC 124 ms
55,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        int ans = 0;
        if (x >= y) {
            ans += y;
            x -= y;
            ans += Math.min(x, z);
            z -= x;
            if (z > 0) {
                ans += z / 2;
            }
        } else {
            ans += x;
            y -= x;
            ans += Math.min(y, z);
            z -= y;
            if (z > 0) {
                ans += z / 2;
            }
        }
        System.out.println(ans);
    }
}
0