結果

問題 No.920 あかあお
ユーザー iwa_choco_168iwa_choco_168
提出日時 2019-12-01 22:08:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 2,389 ms
コンパイル使用メモリ 74,568 KB
実行使用メモリ 54,324 KB
最終ジャッジ日時 2024-05-01 15:04:35
合計ジャッジ時間 4,600 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
53,756 KB
testcase_01 AC 118 ms
54,036 KB
testcase_02 AC 115 ms
53,980 KB
testcase_03 AC 107 ms
53,336 KB
testcase_04 AC 115 ms
53,784 KB
testcase_05 AC 114 ms
54,000 KB
testcase_06 AC 101 ms
53,048 KB
testcase_07 AC 91 ms
52,160 KB
testcase_08 AC 102 ms
52,684 KB
testcase_09 AC 117 ms
54,324 KB
testcase_10 AC 112 ms
53,984 KB
testcase_11 AC 99 ms
52,556 KB
testcase_12 AC 100 ms
53,792 KB
testcase_13 AC 98 ms
52,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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 ans;
        if(z >= Math.abs(x - y)){
            z -= Math.abs(x - y);
            ans = Math.max(x, y) + z / 2;
        } else {
            ans = Math.min(x, y) + z;
        }
        
        //出力
        System.out.println(ans);
    }
}
0