結果

問題 No.920 あかあお
ユーザー iwa_choco_168iwa_choco_168
提出日時 2019-12-01 22:08:00
言語 Java19
(openjdk 21)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 2,641 ms
コンパイル使用メモリ 72,540 KB
実行使用メモリ 56,164 KB
最終ジャッジ日時 2023-08-14 01:57:21
合計ジャッジ時間 4,421 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
55,636 KB
testcase_01 AC 95 ms
55,772 KB
testcase_02 AC 96 ms
55,696 KB
testcase_03 AC 95 ms
55,644 KB
testcase_04 AC 97 ms
55,836 KB
testcase_05 AC 92 ms
56,164 KB
testcase_06 AC 92 ms
55,400 KB
testcase_07 AC 93 ms
56,000 KB
testcase_08 AC 93 ms
55,688 KB
testcase_09 AC 95 ms
55,808 KB
testcase_10 AC 92 ms
55,544 KB
testcase_11 AC 95 ms
55,804 KB
testcase_12 AC 92 ms
55,772 KB
testcase_13 AC 93 ms
55,796 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