307067: CF1296D. Fight with Monsters
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Fight with Monsters
题意翻译
现在有 $n$ 只怪兽,对于第 $i$ 只怪兽它的血量为 $h_i$ 你和你的敌人攻击力分别为 $a,b$ 打怪兽的流程是这样的 $:$ 你和你的敌人首先来到第一只怪兽前,你对怪兽造成 $a$ 点伤害,你的敌人对怪兽造成 $b$ 点伤害,在是你攻击再敌人攻击直到怪兽死亡 $(h_i \le 0)$ ,如此一直打完 $n$ 只怪兽 如果在你攻击的时候怪兽死了,那么你可以获得 $1$ 分,现在你有某种办法让敌人跳过他的回合,但这只能使用 $k$ 次 现在问你最多能获得多少分题目描述
There are $ n $ monsters standing in a row numbered from $ 1 $ to $ n $ . The $ i $ -th monster has $ h_i $ health points (hp). You have your attack power equal to $ a $ hp and your opponent has his attack power equal to $ b $ hp. You and your opponent are fighting these monsters. Firstly, you and your opponent go to the first monster and fight it till his death, then you and your opponent go the second monster and fight it till his death, and so on. A monster is considered dead if its hp is less than or equal to $ 0 $ . The fight with a monster happens in turns. 1. You hit the monster by $ a $ hp. If it is dead after your hit, you gain one point and you both proceed to the next monster. 2. Your opponent hits the monster by $ b $ hp. If it is dead after his hit, nobody gains a point and you both proceed to the next monster. You have some secret technique to force your opponent to skip his turn. You can use this technique at most $ k $ times in total (for example, if there are two monsters and $ k=4 $ , then you can use the technique $ 2 $ times on the first monster and $ 1 $ time on the second monster, but not $ 2 $ times on the first monster and $ 3 $ times on the second monster). Your task is to determine the maximum number of points you can gain if you use the secret technique optimally.输入输出格式
输入格式
The first line of the input contains four integers $ n, a, b $ and $ k $ ( $ 1 \le n \le 2 \cdot 10^5, 1 \le a, b, k \le 10^9 $ ) — the number of monsters, your attack power, the opponent's attack power and the number of times you can use the secret technique. The second line of the input contains $ n $ integers $ h_1, h_2, \dots, h_n $ ( $ 1 \le h_i \le 10^9 $ ), where $ h_i $ is the health points of the $ i $ -th monster.
输出格式
Print one integer — the maximum number of points you can gain if you use the secret technique optimally.
输入输出样例
输入样例 #1
6 2 3 3
7 10 50 12 1 8
输出样例 #1
5
输入样例 #2
1 1 100 99
100
输出样例 #2
1
输入样例 #3
7 4 2 1
1 3 5 4 2 7 6
输出样例 #3
6