結果

問題 No.920 あかあお
ユーザー d-yoshd-yosh
提出日時 2019-12-09 08:29:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 608 bytes
コンパイル時間 4,645 ms
コンパイル使用メモリ 72,220 KB
実行使用メモリ 56,148 KB
最終ジャッジ日時 2023-09-02 13:14:50
合計ジャッジ時間 7,503 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,872 KB
testcase_01 AC 113 ms
55,836 KB
testcase_02 AC 114 ms
55,936 KB
testcase_03 AC 114 ms
55,804 KB
testcase_04 AC 114 ms
56,148 KB
testcase_05 AC 114 ms
55,780 KB
testcase_06 AC 116 ms
55,612 KB
testcase_07 AC 115 ms
55,456 KB
testcase_08 AC 118 ms
55,296 KB
testcase_09 AC 116 ms
56,056 KB
testcase_10 AC 117 ms
54,040 KB
testcase_11 AC 116 ms
55,640 KB
testcase_12 AC 115 ms
55,856 KB
testcase_13 AC 114 ms
55,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        int z = Integer.parseInt(sc.next());

        int res = 0;
        int rest = 0;
        if(x < y) {
            res += x;
            rest = y - x;
        } else {
            res += y;
            rest = x - y;
        }

        if(rest < z) {
            res += (rest + z) / 2;
        }else {
            res += z;
        }

        System.out.println(res);
    }
}
0