結果

問題 No.1446 ハンバーグと納豆ごはん
ユーザー ApassApass
提出日時 2021-03-31 14:31:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 3,432 ms
コンパイル使用メモリ 74,708 KB
実行使用メモリ 54,192 KB
最終ジャッジ日時 2024-12-14 19:11:57
合計ジャッジ時間 9,229 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
54,080 KB
testcase_01 AC 133 ms
53,984 KB
testcase_02 AC 131 ms
54,032 KB
testcase_03 AC 133 ms
54,020 KB
testcase_04 AC 133 ms
54,116 KB
testcase_05 AC 134 ms
53,704 KB
testcase_06 AC 132 ms
53,952 KB
testcase_07 AC 134 ms
54,016 KB
testcase_08 AC 129 ms
54,016 KB
testcase_09 AC 131 ms
54,044 KB
testcase_10 AC 132 ms
53,784 KB
testcase_11 AC 131 ms
53,976 KB
testcase_12 AC 134 ms
54,060 KB
testcase_13 AC 130 ms
54,140 KB
testcase_14 AC 135 ms
53,824 KB
testcase_15 AC 130 ms
54,024 KB
testcase_16 AC 116 ms
52,896 KB
testcase_17 AC 130 ms
54,068 KB
testcase_18 AC 130 ms
53,680 KB
testcase_19 AC 125 ms
53,916 KB
testcase_20 AC 129 ms
53,952 KB
testcase_21 AC 113 ms
52,792 KB
testcase_22 AC 124 ms
53,756 KB
testcase_23 AC 126 ms
53,976 KB
testcase_24 AC 131 ms
54,144 KB
testcase_25 AC 128 ms
53,880 KB
testcase_26 AC 123 ms
52,988 KB
testcase_27 AC 134 ms
53,840 KB
testcase_28 AC 131 ms
54,020 KB
testcase_29 AC 114 ms
53,036 KB
testcase_30 AC 127 ms
54,180 KB
testcase_31 AC 119 ms
52,584 KB
testcase_32 AC 129 ms
53,852 KB
testcase_33 AC 129 ms
53,896 KB
testcase_34 AC 132 ms
54,192 KB
testcase_35 AC 125 ms
54,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class B_HamburgerAndNattoRice {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long N = sc.nextLong();
        long M = sc.nextLong();

        long lunch;
        if (A <= B) {
            long d = B - A;
            lunch = A + d / (M + 1);
        } else {
            long d = A - B;
            lunch = B + d / (N + 1);
        }
        System.out.println(lunch);
    }
}
0