結果

問題 No.1446 ハンバーグと納豆ごはん
ユーザー ApassApass
提出日時 2021-03-31 14:31:14
言語 Java19
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 3,970 ms
コンパイル使用メモリ 71,740 KB
実行使用メモリ 57,860 KB
最終ジャッジ日時 2023-08-21 09:05:13
合計ジャッジ時間 10,339 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,460 KB
testcase_01 AC 120 ms
55,888 KB
testcase_02 AC 120 ms
55,460 KB
testcase_03 AC 122 ms
55,900 KB
testcase_04 AC 122 ms
55,844 KB
testcase_05 AC 124 ms
57,528 KB
testcase_06 AC 122 ms
55,708 KB
testcase_07 AC 120 ms
55,708 KB
testcase_08 AC 121 ms
55,736 KB
testcase_09 AC 121 ms
56,484 KB
testcase_10 AC 121 ms
55,800 KB
testcase_11 AC 122 ms
55,800 KB
testcase_12 AC 123 ms
55,784 KB
testcase_13 AC 123 ms
53,804 KB
testcase_14 AC 123 ms
55,468 KB
testcase_15 AC 124 ms
56,332 KB
testcase_16 AC 123 ms
55,292 KB
testcase_17 AC 124 ms
55,688 KB
testcase_18 AC 125 ms
57,860 KB
testcase_19 AC 123 ms
55,776 KB
testcase_20 AC 123 ms
55,640 KB
testcase_21 AC 124 ms
55,720 KB
testcase_22 AC 125 ms
55,616 KB
testcase_23 AC 124 ms
55,684 KB
testcase_24 AC 123 ms
55,380 KB
testcase_25 AC 123 ms
55,792 KB
testcase_26 AC 124 ms
55,544 KB
testcase_27 AC 123 ms
55,808 KB
testcase_28 AC 123 ms
57,572 KB
testcase_29 AC 124 ms
55,668 KB
testcase_30 AC 126 ms
53,980 KB
testcase_31 AC 126 ms
55,288 KB
testcase_32 AC 126 ms
55,200 KB
testcase_33 AC 123 ms
55,672 KB
testcase_34 AC 122 ms
53,544 KB
testcase_35 AC 122 ms
55,620 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