結果

問題 No.604 誕生日のお小遣い
ユーザー Masaki KitaguchiMasaki Kitaguchi
提出日時 2022-01-16 01:46:36
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 932 bytes
コンパイル時間 6,253 ms
コンパイル使用メモリ 120,220 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-14 12:53:54
合計ジャッジ時間 5,114 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#[macro_export]
macro_rules! setup {
    { mut $input:ident: SplitWhitespace $(,)? } => {
        use std::io::Read;
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).ok();
        let mut $input = buf.split_whitespace();
    };
}

#[macro_export]
macro_rules! parse_next {
    ($str_iter:expr) => {
        $str_iter.next().unwrap().parse().ok().unwrap()
    };
}

fn main() {
    setup! { mut input: SplitWhitespace };

    let a: u64 = parse_next!(input);
    let b: u64 = parse_next!(input);
    let c: u64 = parse_next!(input);

    let ans = (|| {
        let mut left = 0;
        let mut right = c + 1;
        while right - left > 1 {
            let mid = (left + right) / 2;
            match (mid - (mid / a)) + (mid / a) * b >= c {
                true => right = mid,
                false => left = mid,
            }
        }
        right
    })();

    println!("{}", ans);
}
0