CF492D.Vanya and Computer Game
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency y hits per second. Each character spends fixed time to raise a weapon and then he hits (the time to raise the weapon is 1 / x seconds for the first character and 1 / y seconds for the second one). The i-th monster dies after he receives a__i hits.
Vanya and Vova wonder who makes the last hit on each monster. If Vanya and Vova make the last hit at the same time, we assume that both of them have made the last hit.
万尼亚和他的朋友沃瓦正在玩一款电脑游戏,他们需要消灭 n 只怪物才能通过当前关卡。万尼亚的角色攻击频率为每秒 x 次,沃瓦的角色攻击频率为每秒 y 次。每位角色每次攻击前需固定时间举起武器,随后立即造成一次伤害(第一位角色举武器耗时 x1 秒,第二位角色举武器耗时 y1 秒)。第 i 只怪物在受到 ai 次攻击后死亡。
万尼亚和沃瓦想知道:对每只怪物,最后一击是由谁造成的?若万尼亚与沃瓦在同一时刻造成最后一击,则认为两人共同造成了最后一击。
输入格式
The first line contains three integers n,x,y (1 ≤ n ≤ 105, 1 ≤ x, y ≤ 106) — the number of monsters, the frequency of Vanya's and Vova's attack, correspondingly.
Next n lines contain integers a__i (1 ≤ a__i ≤ 109) — the number of hits needed do destroy the i-th monster.
第一行包含三个整数 n、x、y(1 ≤ n ≤ 105,1 ≤ x, y ≤ 106)—— 分别表示怪物的数量、Vanya 和 Vova 的攻击频率。
接下来的 n 行每行包含一个整数 ai(1 ≤ ai ≤ 109)—— 表示击败第 i 个怪物所需的攻击次数。
输出格式
Print n lines. In the i-th line print word "Vanya", if the last hit on the i-th monster was performed by Vanya, "Vova", if Vova performed the last hit, or "Both", if both boys performed it at the same time.
输出 n 行。在第 i 行中,如果对第 i 个怪物的最后一次攻击由 Vanya 完成,则输出单词 "Vanya";如果由 Vova 完成,则输出 "Vova";如果两人同时完成最后一次攻击,则输出 "Both"。
输入输出样例
输入#1
4 3 2 1 2 3 4
输出#1
Vanya Vova Vanya Both
输入#2
2 1 1 1 2
输出#2
Both Both
说明/提示
In the first sample Vanya makes the first hit at time 1 / 3, Vova makes the second hit at time 1 / 2, Vanya makes the third hit at time 2 / 3, and both boys make the fourth and fifth hit simultaneously at the time 1.
In the second sample Vanya and Vova make the first and second hit simultaneously at time 1.
在第一个样例中,万尼亚在时刻 1/3 发起第一次攻击,沃瓦在时刻 1/2 发起第二次攻击,万尼亚在时刻 2/3 发起第三次攻击,而两名男孩则在时刻 1 同时发起第四次和第五次攻击。
在第二个样例中,万尼亚和沃瓦在时刻 1 同时发起第一次和第二次攻击。
输入解题思路,AI测评打分。不知道怎么写?