Problem:
Score : 100 points

Problem Statement

Serval is fighting with a monster.

The health of the monster is H.

In one attack, Serval can decrease the monster's health by A.
There is no other way to decrease the monster's health.

Serval wins when the monster's health becomes 0 or below.

Find the number of attacks Serval needs to make before winning.

Constraints

1 \leq H \leq 10^4

1 \leq A \leq 10^4

All values in input are integers.

Input

Input is given from Standard Input in the following format:

H A

Output

Print the number of attacks Serval needs to make before winning.

Sample Input 1

10 4

Sample Output 1

3

After one attack, the monster's health will be 6.

After two attacks, the monster's health will be 2.

After three attacks, the monster's health will be -2.

Thus, Serval needs to make three attacks to win.

Sample Input 2

1 10000

Sample Output 2

1

Sample Input 3

10000 1

Sample Output 3

10000

Solution in Rust (1.15.1) (judge verdict: Runtime Error)

use std::io::stdin;

fn main() {
    let mut stack = [0; 3];
    // 0: モンスター数, 1: 爆弾の範囲, 2: 爆弾のダメージnn
    {
        let mut input = String::new();
        stdin().read_line(&mut input).unwrap();
        for (i, j) in input.split_whitespace().enumerate() {
            stack[i] = j.parse::<i32>().unwrap();
        }
    }

    let mut each_location_and_hp: Vec<Vec<i32>> = Vec::new();
    // 0: location, 1: hp
    for _i in 0..stack[0] {
        let mut input = String::new();
        stdin().read_line(&mut input).unwrap();
        each_location_and_hp.push(
            input.split_whitespace()
                .map(|x| x.parse::<i32>().unwrap())
                .collect()
        )
    }
    each_location_and_hp.sort();
    each_location_and_hp.reverse();

    let mut used_bombs: i64 = 0;
    let mut _effected_range_by_bomb = 0;
    let mut _using_bomb_on_this_time = 0;
    let mut index: usize = 0;

    let bomb_range = stack[1] * 2;
    let damage = stack[2];

    while &each_location_and_hp.len() > &0 {
    // loop {
    // for (i, mons) in each_location_and_hp.iter().enumerate() {
        // モンスターを取得
        // let next_monster = mons;
        {
            let next_monster = each_location_and_hp.pop().unwrap();
            //.... 最初のモンス

            // すでに死んでた時は次のループに
            if next_monster[1] <= 0 { continue }

            // 爆弾の範囲を指定
            _effected_range_by_bomb = next_monster[0] + bomb_range;
            _using_bomb_on_this_time = (next_monster[1] + damage -1) / damage;
            used_bombs += _using_bomb_on_this_time as i64;
            _using_bomb_on_this_time *= damage;

        }

        // for 内で使うインデックスを変更（配列の後ろの方から取得するように変更）
        index = each_location_and_hp.len() - 1 as usize;
        for _i in 0..bomb_range {
            // すでに死んでた時は次のループ
            if each_location_and_hp[index][1] <= 0 { continue }

            //爆弾の巻き添えになったとき
            if each_location_and_hp[index][0] <= _effected_range_by_bomb {
                // hpを減算
                each_location_and_hp[index][1] -= _using_bomb_on_this_time;
            } else {
                //巻き添え範囲から出た時はループ脱出
                break;
            }
            index -= 1 as usize;
        }
    }
    println!("{}", used_bombs);
}