103570: [Atcoder]ABC357 A - Sanitize Hands

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:8 Solved:0

Description

Score : $100$ points

Problem Statement

There is a bottle of disinfectant that can disinfect exactly $M$ hands.

$N$ aliens come one by one to disinfect their hands.
The $i$-th alien ($1 \leq i \leq N$) has $H_i$ hands and wants to disinfect all of their hands once.

Determine how many aliens can disinfect all of their hands.
Here, even if there is not enough disinfectant left for an alien to disinfect all of their hands when they start, they will use up the remaining disinfectant.

Constraints

  • $1 \leq N, M \leq 100$
  • $1 \leq H_i \leq 100$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

$N$ $M$
$H_1$ $H_2$ $\ldots$ $H_N$

Output

Print the number of aliens who can disinfect all of their hands.


Sample Input 1

5 10
2 3 2 5 3

Sample Output 1

3

The aliens disinfect their hands in the following steps:

  • The first alien disinfects their two hands. The remaining disinfectant can disinfect $10-2=8$ hands.
  • The second alien disinfects their three hands. The remaining disinfectant can disinfect $8-3=5$ hands.
  • The third alien disinfects their two hands. The remaining disinfectant can disinfect $5-2=3$ hands.
  • The fourth alien has five hands, but there is only enough disinfectant for three hands, so they use up the disinfectant without disinfecting all of their hands.

Thus, the first three aliens can disinfect all of their hands, so print $3$.


Sample Input 2

5 10
2 3 2 3 5

Sample Output 2

4

Sample Input 3

1 5
1

Sample Output 3

1

All aliens can disinfect their hands.

Output

得分:100分 问题描述: 有一瓶消毒液,恰好可以给 $M$ 只手消毒。 有 $N$ 个外星人依次来给自己的手消毒,每个外星人有 $H_i$ 只手,希望把它们全部消毒一遍。 确定有多少个外星人可以完全消毒他们的手。即使在某个外星人开始消毒时,消毒液不足以让其消毒所有手,他们也会用完剩余的消毒液。 限制条件: - $1 \leq N, M \leq 100$ - $1 \leq H_i \leq 100$ - 所有输入值都是整数。 输入: 输入从标准输入中给出,格式如下: $N$ $M$ $H_1$ $H_2$ $\ldots$ $H_N$ 输出: 打印出可以完全消毒所有手的外星人数。 样例输入1: 5 10 2 3 2 5 3 样例输出1: 3 解释: 外星人的消毒步骤如下: - 第一个外星人消毒了两只手,剩余消毒液可以消毒 $10-2=8$ 只手。 - 第二个外星人消毒了三只手,剩余消毒液可以消毒 $8-3=5$ 只手。 - 第三个外星人消毒了两只手,剩余消毒液可以消毒 $5-2=3$ 只手。 - 第四个外星人有五只手,但只有足够的消毒液消毒三只手,所以他们用完了消毒液,没有完全消毒所有手。 因此,前三个外星人可以完全消毒他们的手,所以打印出 $3$。 样例输入2: 5 10 2 3 2 3 5 样例输出2: 4 样例输入3: 1 5 1 样例输出3: 1 所有外星人都可以消毒他们的手。

加入题单

上一题 下一题 算法标签: