結果
| 問題 | No.604 誕生日のお小遣い |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-16 01:46:36 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 932 bytes |
| 記録 | |
| コンパイル時間 | 15,055 ms |
| コンパイル使用メモリ | 376,388 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-22 10:20:04 |
| 合計ジャッジ時間 | 15,051 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 7 |
ソースコード
#[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);
}