結果

問題 No.920 あかあお
ユーザー tenten
提出日時 2020-11-12 18:30:07
言語 Java
(openjdk 23)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 663 bytes
コンパイル時間 2,319 ms
コンパイル使用メモリ 74,540 KB
実行使用メモリ 41,336 KB
最終ジャッジ日時 2024-07-22 19:42:02
合計ジャッジ時間 4,706 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

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