結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,540 KB
testcase_01 AC 141 ms
41,208 KB
testcase_02 AC 141 ms
41,276 KB
testcase_03 AC 137 ms
41,612 KB
testcase_04 AC 136 ms
41,136 KB
testcase_05 AC 137 ms
41,344 KB
testcase_06 AC 137 ms
41,404 KB
testcase_07 AC 138 ms
41,536 KB
testcase_08 AC 139 ms
41,432 KB
testcase_09 AC 139 ms
41,316 KB
testcase_10 AC 139 ms
41,564 KB
testcase_11 AC 139 ms
41,208 KB
testcase_12 AC 140 ms
41,176 KB
testcase_13 AC 141 ms
41,468 KB
testcase_14 AC 138 ms
41,404 KB
testcase_15 AC 139 ms
41,344 KB
testcase_16 AC 137 ms
41,064 KB
testcase_17 AC 138 ms
41,416 KB
testcase_18 AC 141 ms
41,596 KB
testcase_19 AC 139 ms
41,360 KB
testcase_20 AC 139 ms
41,252 KB
testcase_21 AC 140 ms
41,640 KB
testcase_22 AC 139 ms
41,180 KB
testcase_23 AC 141 ms
41,404 KB
testcase_24 AC 138 ms
41,424 KB
testcase_25 AC 138 ms
41,304 KB
testcase_26 AC 139 ms
41,472 KB
testcase_27 AC 136 ms
41,536 KB
testcase_28 AC 137 ms
41,112 KB
testcase_29 AC 138 ms
41,224 KB
testcase_30 AC 139 ms
41,468 KB
testcase_31 AC 139 ms
41,456 KB
testcase_32 AC 138 ms
41,560 KB
testcase_33 AC 137 ms
41,356 KB
testcase_34 AC 138 ms
41,324 KB
testcase_35 AC 137 ms
41,460 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