結果

問題 No.128 お年玉(1)
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-29 16:04:10
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 921 bytes
コンパイル時間 2,171 ms
コンパイル使用メモリ 74,732 KB
実行使用メモリ 54,012 KB
最終ジャッジ日時 2024-04-08 19:06:27
合計ジャッジ時間 4,525 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 54 ms
53,964 KB
testcase_05 AC 55 ms
53,964 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 54 ms
53,988 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        long N = Long.parseLong(reader.readLine());
        long M = Long.parseLong(reader.readLine());
        findMaximunOtosidama(N, M);
    }

    private static void findMaximunOtosidama(long N, long M) {
        long lo = 1;
        long hi = Long.MAX_VALUE/2;
        while (lo < hi) {
            long mid = lo + (hi - lo + 1) / 2;
            if (isFeasible(N, M, mid)) {
                lo = mid;
            } else {
                hi = mid - 1;
            }
        }
        System.out.println(lo);
    }

    private static boolean isFeasible(long N, long M, long money) {
        return money * M <= N;
    }

}
0