Skip to content

Commit

Permalink
past202303-open d
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Nov 24, 2023
1 parent 5c28c3b commit 2d8c603
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions cargo-atcoder-1.70.0/contests/past202303-open/src/bin/d.rs
@@ -1,10 +1,31 @@
use proconio::{input, marker::Usize1};
use proconio::input;

fn main() {
input! {
n: usize,
a: [Usize1; n],
h: usize,
a: usize,
b: usize,
c: usize,
d: usize,
};
let ans = n - a.len();

let mut min = 1 << 60;
for i in 0..100 {
let mut price = 0_usize;
let mut h = h;
for _ in 0..i {
price += d;
h = h.saturating_sub(c);
if h == 0 {
break;
}
h -= h / 2;
}
if h > 0 {
price += (h + a - 1) / a * b;
}
min = min.min(price);
}
let ans = min;
println!("{}", ans);
}

0 comments on commit 2d8c603

Please sign in to comment.