QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 1024 MB 總分: 100 可 Hack ✓

#18670. 지금 자면 꿈을 꾸지만

统计

「現在睡覺會做夢,但現在讀書才能實現夢想。」這句話廣為人知,但 Silver 的想法略有不同。Silver 認為,睡個好覺來提高學習效率更為重要。由於有許多作業要做,Silver 打算適當地睡眠,以完成盡可能多的作業。

Silver 有 $N$ 個作業,第 $i$ 個作業的截止時間為 $T_i$。Silver 從時間 0 開始,可以在任意時間選擇一個作業來進行。一次只能進行一個作業,且不能在進行一個作業的過程中開始另一個作業。Silver 完成一個作業需要 $A$ 單位時間。

Silver 可以選擇一個介於 $0$ 到 $(A-1)$ 之間的整數 $X$,然後睡 $BX$ 單位時間。睡覺之後,完成一個作業所需的時間變為 $(A-X)$。Silver 最多可以睡一次覺,且不能在進行作業的過程中睡覺。此外,也可以從時間 0 就開始睡覺。

Silver 希望透過適當地睡覺,最大化在截止時間內完成的作業數量。若第 $i$ 個作業恰好於時間 $T_i$ 完成,也視為在截止時間內完成。

請計算能在截止時間內完成的作業的最大數量!

輸入格式

第一行給定作業數量 $N$、完成一個作業所需的初始時間 $A$、以及縮短作業完成時間的基準整數 $B$。($1 \le N, A, B \le 100$)

第二行給定每個作業的截止時間 $T_i$。($1 \le T_i \le 10\,000$)

輸入的所有數字均為整數。

輸出格式

第一行輸出能在截止時間內完成的作業的最大數量。

範例

範例輸入 1

3 40 2
70 90 80

範例輸出 1

3

範例輸入 2

3 40 10
70 90 80

範例輸出 2

2

範例輸入 3

4 30 3
70 75 95 105

範例輸出 3

4

範例輸入 4

8 2 5
2 8 9 10 11 12 13 14

範例輸出 4

8

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.