QOJ.ac

QOJ

时间限制: 2 s 内存限制: 256 MB 总分: 100

#22398. O Those Fads

统计

Like any other teenager, teen cows are occasionally overtaken by fads. Sometimes it's a hula hoop or a pet rock, other times it's Counterstrike, Pokemon, Rick Astley, or tribal tattoos on their udders.

Mathematically, we know that a fad has an initial attractiveness level $L$ ($1 \le L \le 50,000$). Cow $i$ has a resistance ($0 \le R_{i} \le 1,000,000$) that tells how long she can avoid a fad before having no alternative but to participate. When a fad's attractiveness level meets or exceeds a cow's fad resistance, then the cow will want to participate in the fad.

Each cow who participates in a fad increases (through peer pressure) that fad's attractiveness by some value $K$ ($1 \le K \le 2,500$).

Given a population of $N$ ($1 \le N \le 100,000$) cows, determine how many will participate in a fad.

Input

  • Line 1: Three space-separated integers: $N$, $L$, and $K$
  • Lines $2..N+1$: Line $i+1$ contains cow $i$'s a single integer that is fad resistance: $R_{i}$

Output

  • Line 1: A single integer that is the number of cows how ultimately participate in the fad.

Examples

Input 1

5 2 3
2
6
12
5
14

Output 1

3

Five cows with fad resistances 2, 6, 12, 5, and 14. Initial fad attractiveness is 2; peer pressure adds 3 for each attractiveness index for each cow that participates.

The initial attraction level of 2 brings in cow #1 (whose resistance is 2) and raises the attractiveness level to 5, thus attracting cow #4 (whose resistance is 5) and raising the attractiveness level to 8. This attracts cow #2 (resistance: 6) and raises the attractiveness level to 11. Neither cow #3 (resistance: 12) or cow #5 (resistance: 14) is sucked into the fad; a total of 3 cows particpate.

Problem credits: Jarrah Lacko, 2009

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.