結果

問題 No.604 誕生日のお小遣い
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-05-20 17:33:38
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 74,408 KB
実行使用メモリ 57,712 KB
最終ジャッジ日時 2023-10-17 08:07:14
合計ジャッジ時間 6,896 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 132 ms
57,396 KB
testcase_02 AC 130 ms
57,412 KB
testcase_03 AC 134 ms
57,428 KB
testcase_04 AC 131 ms
57,432 KB
testcase_05 AC 135 ms
57,440 KB
testcase_06 AC 132 ms
57,420 KB
testcase_07 AC 132 ms
57,448 KB
testcase_08 AC 135 ms
57,464 KB
testcase_09 AC 132 ms
57,436 KB
testcase_10 AC 132 ms
57,336 KB
testcase_11 AC 133 ms
57,296 KB
testcase_12 AC 132 ms
55,692 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 133 ms
57,712 KB
testcase_16 AC 132 ms
57,436 KB
testcase_17 AC 131 ms
57,556 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        long a = stdin.nextLong();
        long b = stdin.nextLong();
        long c = stdin.nextLong();
        
        long left = -1;
        long right = c + 1;
        while (right - left > 1) {
            long mid = left + (right - left) / 2;
            
            long sum = b * (mid / a) + (mid - mid / a);
            if (c <= sum) {
                right = mid;
            } else {
                left = mid;
            }
        }
        
        System.out.println(right);
    }
}
0