C. Japanese Cursed Doll

    传统题 1000ms 256MiB

Japanese Cursed Doll

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Statement

There are NN people, and the current hair length of the ii-th person (1iN)(1 \le i \le N) is LiL_i.

Each person's hair grows by 11 per day.

Print the number of days after which the number of people whose hair length is at least TT becomes PP or more for the first time.

If there are already PP or more people whose hair length is at least TT now, print 00.

Constraints

  • 1N1001 \le N \le 100
  • 1Li1001 \le L_i \le 100
  • 1T1001 \le T \le 100
  • 1PN1 \le P \le N
  • All input values are integers.

Input

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

N T P
L1 L2 L3 ... LN

Output

Print the number of days after which the number of people whose hair length is at least TT becomes PP or more for the first time. If this condition is already satisfied now, print 00.

Sample

5 10 3
3 11 1 6 2
7

There are five people, and their current hair lengths are 3,11,1,6,23,11,1,6,2, so there is one person whose hair length is at least 1010.

After seven days, the hair lengths of the people will be 10,18,8,13,910,18,8,13,9, respectively, and there will be three people whose hair length is at least 1010.

After six days, there are only two people whose hair length is at least 1010, not satisfying the condition, so print 77.

2 5 2
10 10
0

Since there are already two people whose hair length is at least 55 now, satisfying the condition, so print 00.

3 10 1
1 2 3
7

Programming exercise on 11 August

未参加
状态
已结束
规则
IOI
题目
4
开始于
2024-8-11 16:30
结束于
2024-8-11 17:30
持续时间
1 小时
主持人
参赛人数
2