309717: CF1725B. Basketball Together

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

Description

Basketball Together

题意翻译

**【题目描述】** 在篮球比赛中,一个队的球员人数没有最大或最小限制(不一定每场比赛有 $5$ 名球员)。比赛中有 $N$ 名候选球员将由世界上最好的篮球教练 Pak Chanek 训练。第二个候选玩家具有 $P_i$ 的幂。 Pak Chanek 将从 $N$ 名候选球员中组成零支或多支球队,条件是每个候选球员最多只能加入一支球队。Pak Chanek 的每一支球队都将被派去与拥有 $D$ 力量的敌方球队进行一次比赛。在每一场比赛中,如果阵型球员的力量之和严格大于 $D$,则被派去的球队将被称为击败敌方球队。 Pak Chanek 的一项技能是,当一支已经组建的球队在比赛中比赛时,他可以改变球队中每个球员的力量,使之等于球队中最大的球员力量。 输出 Pak Chanek 可获得的最大获胜次数。 **【输入格式】** 第一行包含两个整数 $N$ 和 $D$($1 \le N \le 10^5 ,1 \le D \le 10^9$ ),候选球员的数量和敌方球队的实力。 第二行包含 $N$ 个整数 $P_1$、$P_2$、$\ldots$、$P_ N$($1≤P_i≤10^9$),所有候选玩家的权力。 **【输出格式】** 一行,包含一个整数,表示 Pak Chanek 可以获得的最大胜利数。

题目描述

A basketball competition is held where the number of players in a team does not have a maximum or minimum limit (not necessarily $ 5 $ players in one team for each match). There are $ N $ candidate players in the competition that will be trained by Pak Chanek, the best basketball coach on earth. The $ i $ -th candidate player has a power of $ P_i $ . Pak Chanek will form zero or more teams from the $ N $ candidate players on the condition that each candidate player may only join in at most one team. Each of Pak Chanek's teams will be sent to compete once with an enemy team that has a power of $ D $ . In each match, the team sent is said to defeat the enemy team if the sum of powers from the formed players is strictly greater than $ D $ . One of Pak Chanek's skills is that when a team that has been formed plays in a match, he can change the power of each player in the team to be equal to the biggest player power from the team. Determine the maximum number of wins that can be achieved by Pak Chanek.

输入输出格式

输入格式


The first line contains two integers $ N $ and $ D $ ( $ 1 \le N \le 10^5 $ , $ 1 \le D \le 10^9 $ ) — the number of candidate players and the power of the enemy team. The second line contains $ N $ integers $ P_1, P_2, \ldots, P_N $ ( $ 1 \le P_i \le 10^9 $ ) — the powers of all candidate players.

输出格式


A line containing an integer representing the maximum number of wins that can be achieved by Pak Chanek.

输入输出样例

输入样例 #1

6 180
90 80 70 60 50 100

输出样例 #1

2

说明

The $ 1 $ -st team formed is a team containing players $ 4 $ and $ 6 $ . The power of each player in the team becomes $ 100 $ . So the total power of the team is $ 100 + 100 = 200 > 180 $ . The $ 2 $ -nd team formed is a team containing players $ 1 $ , $ 2 $ , and $ 5 $ . The power of each player in the team becomes $ 90 $ . So the total power of the team is $ 90 + 90 + 90 = 270 > 180 $ .

Input

题意翻译

**【题目描述】** 在篮球比赛中,一个队的球员人数没有最大或最小限制(不一定每场比赛有 $5$ 名球员)。比赛中有 $N$ 名候选球员将由世界上最好的篮球教练 Pak Chanek 训练。第二个候选玩家具有 $P_i$ 的幂。 Pak Chanek 将从 $N$ 名候选球员中组成零支或多支球队,条件是每个候选球员最多只能加入一支球队。Pak Chanek 的每一支球队都将被派去与拥有 $D$ 力量的敌方球队进行一次比赛。在每一场比赛中,如果阵型球员的力量之和严格大于 $D$,则被派去的球队将被称为击败敌方球队。 Pak Chanek 的一项技能是,当一支已经组建的球队在比赛中比赛时,他可以改变球队中每个球员的力量,使之等于球队中最大的球员力量。 输出 Pak Chanek 可获得的最大获胜次数。 **【输入格式】** 第一行包含两个整数 $N$ 和 $D$($1 \le N \le 10^5 ,1 \le D \le 10^9$ ),候选球员的数量和敌方球队的实力。 第二行包含 $N$ 个整数 $P_1$、$P_2$、$\ldots$、$P_ N$($1≤P_i≤10^9$),所有候选玩家的权力。 **【输出格式】** 一行,包含一个整数,表示 Pak Chanek 可以获得的最大胜利数。

Output

**题目大意:**

在篮球比赛中,没有规定球队中球员数量的最大或最小限制(每支球队不一定非要有5名球员)。比赛中有 $N$ 名候选球员将由世界上最好的篮球教练 Pak Chanek 训练。每个候选球员具有不同的力量 $P_i$。

Pak Chanek 可以从这 $N$ 名候选球员中组成零支或多支球队,条件是每个候选球员最多只能加入一支球队。Pak Chanek 的每一支球队都将被派去与拥有 $D$ 力量的敌方球队进行一次比赛。在每一场比赛中,如果球队中球员的力量之和严格大于 $D$,则这支球队将击败敌方球队。

Pak Chanek 拥有一项技能,可以在比赛中改变球队中每个球员的力量,使之等于球队中最大的球员力量。

要求输出 Pak Chanek 可以获得的最大获胜次数。

**输入格式:**

第一行包含两个整数 $N$ 和 $D$($1 \le N \le 10^5$,$1 \le D \le 10^9$),分别表示候选球员的数量和敌方球队的实力。

第二行包含 $N$ 个整数 $P_1, P_2, \ldots, P_N$($1 \le P_i \le 10^9$),分别表示所有候选玩家的力量。

**输出格式:**

输出一行,包含一个整数,表示 Pak Chanek 可以获得的最大胜利数。

**样例输入输出:**

**输入样例 #1:**
```
6 180
90 80 70 60 50 100
```

**输出样例 #1:**
```
2
```

**说明:**

第一个形成的球队包含球员 4 和 6。球队中每个球员的力量变为 100。因此,该球队的总力量为 $100 + 100 = 200 > 180$。

第二个形成的球队包含球员 1、2 和 5。球队中每个球员的力量变为 90。因此,该球队的总力量为 $90 + 90 + 90 = 270 > 180$。**题目大意:** 在篮球比赛中,没有规定球队中球员数量的最大或最小限制(每支球队不一定非要有5名球员)。比赛中有 $N$ 名候选球员将由世界上最好的篮球教练 Pak Chanek 训练。每个候选球员具有不同的力量 $P_i$。 Pak Chanek 可以从这 $N$ 名候选球员中组成零支或多支球队,条件是每个候选球员最多只能加入一支球队。Pak Chanek 的每一支球队都将被派去与拥有 $D$ 力量的敌方球队进行一次比赛。在每一场比赛中,如果球队中球员的力量之和严格大于 $D$,则这支球队将击败敌方球队。 Pak Chanek 拥有一项技能,可以在比赛中改变球队中每个球员的力量,使之等于球队中最大的球员力量。 要求输出 Pak Chanek 可以获得的最大获胜次数。 **输入格式:** 第一行包含两个整数 $N$ 和 $D$($1 \le N \le 10^5$,$1 \le D \le 10^9$),分别表示候选球员的数量和敌方球队的实力。 第二行包含 $N$ 个整数 $P_1, P_2, \ldots, P_N$($1 \le P_i \le 10^9$),分别表示所有候选玩家的力量。 **输出格式:** 输出一行,包含一个整数,表示 Pak Chanek 可以获得的最大胜利数。 **样例输入输出:** **输入样例 #1:** ``` 6 180 90 80 70 60 50 100 ``` **输出样例 #1:** ``` 2 ``` **说明:** 第一个形成的球队包含球员 4 和 6。球队中每个球员的力量变为 100。因此,该球队的总力量为 $100 + 100 = 200 > 180$。 第二个形成的球队包含球员 1、2 和 5。球队中每个球员的力量变为 90。因此,该球队的总力量为 $90 + 90 + 90 = 270 > 180$。

加入题单

算法标签: