結果

問題 No.604 誕生日のお小遣い
コンテスト
ユーザー fushime2
提出日時 2018-03-07 16:01:15
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
WA  
実行時間 -
コード長 517 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 348 ms
コンパイル使用メモリ 88,760 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-05 19:40:27
合計ジャッジ時間 1,017 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import std.stdio, std.algorithm, std.string, std.string, std.conv, std.array, std.range, std.math;

long A, B, C;
bool can(long age) {
    long x = age / A;
    long y = age - x;
    return x * B + y >= C;
}

void main() {
    auto input = readln.split.to!(long[]);
    A = input[0]; B = input[1]; C = input[2];

    long lb = -1, ub = 10L^^18;
    while (ub - lb > 1) {
        long mid = (lb + ub) / 2;
        if (can(mid)) ub = mid;
        else lb = mid;
    }
    writeln(ub);

    string _ = readln(); // dbg
}
0