CF1296D.Fight with Monsters

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are nn monsters standing in a row numbered from 11 to nn. The ii-th monster has hih_i health points (hp). You have your attack power equal to aa hp and your opponent has his attack power equal to bb 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 00.

The fight with a monster happens in turns.

  1. You hit the monster by aa 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 bb 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 kk times in total (for example, if there are two monsters and k=4k=4, then you can use the technique 22 times on the first monster and 11 time on the second monster, but not 22 times on the first monster and 33 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.

有 nn 只怪物排成一列,编号从 11 到 nn。第 ii 只怪物的血量(hp)为 hih_i。你的攻击力为 aa hp,对手的攻击力为 bb hp。

你和对手共同对抗这些怪物。首先,你和对手一起前往第一只怪物并持续攻击直至其死亡;接着一同前往第二只怪物并持续攻击直至其死亡;依此类推。当一只怪物的血量小于等于 00 时,即视为死亡。

与每只怪物的战斗以回合制进行:

  1. 你先对怪物造成 aa 点伤害。若该次攻击后怪物死亡,则你获得 1 分,且你和对手立即前往下一只怪物;
  2. 否则,对手对怪物造成 bb 点伤害。若该次攻击后怪物死亡,则无人得分,且你和对手立即前往下一只怪物。

你拥有一种秘密技巧,可强制对手跳过他的回合。你总共最多可使用该技巧 kk 次(例如,若共有两只怪物且 k=4k = 4,则你可在第一只怪物上使用该技巧 22 次、在第二只怪物上使用 11 次;但不可在第一只怪物上使用 22 次、在第二只怪物上使用 33 次)。

你的任务是:在最优使用该秘密技巧的前提下,求出你能获得的最大分数。

输入格式

The first line of the input contains four integers n,a,bn, a, b and kk (1≤n≤2⋅105,1≤a,b,k≤1091 \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 nn integers h1,h2,…,hnh_1, h_2, \dots, h_n (1≤hi≤1091 \le h_i \le 10^9), where hih_i is the health points of the ii-th monster.

输入的第一行包含四个整数 n,a,bn, a, b 和 kk(1≤n≤2⋅1051 \le n \le 2 \cdot 10^5,1≤a,b,k≤1091 \le a, b, k \le 10^9),分别表示怪物的数量、你的攻击力、对手的攻击力以及你可以使用秘密技能的次数。

输入的第二行包含 nn 个整数 h1,h2,…,hnh_1, h_2, \dots, h_n(1≤hi≤1091 \le h_i \le 10^9),其中 hih_i 表示第 ii 个怪物的生命值。

输出格式

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

输入解题思路,AI测评打分。不知道怎么写?

首页