博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #280 (Div. 2) D. Vanya and Computer Game 二分
阅读量:6201 次
发布时间:2019-06-21

本文共 1759 字,大约阅读时间需要 5 分钟。

D. Vanya and Computer Game

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/492/problem/D

Description

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 ai 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.

Input

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 ai (1 ≤ ai ≤ 109) — the number of hits needed do destroy the i-th monster.

Output

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.

Sample Input

4 3 2 1 2 3 4

Sample Output

Vanya Vova Vanya Both

HINT

 

题意

Vanya每秒钟可以砍x刀,Vova每秒可以砍y刀

有n次询问,给你一个怪兽的血量为ai,然后问你最后一刀是谁补的刀

同时补刀,输出Both

 

题解:

二分是多少s砍死这只怪兽

然后再check就好一下了~

代码

#include
#include
using namespace std;int main(){ int n; long long x,y; scanf("%d%lld%lld",&n,&x,&y); for(int i=0;i
=a)r=mid-1; else l=mid+1; } if(l%x==0&&l%y==0)printf("Both\n"); else if(l%y==0)printf("Vanya\n"); else printf("Vova\n"); }}

 

转载地址:http://hftca.baihongyu.com/

你可能感兴趣的文章
创建spring自定义注解进行自动装配
查看>>
modernizr的介绍和使用
查看>>
DataSet单元格操作
查看>>
CF960G Bandit Blues(第一类斯特林数)
查看>>
bzoj4145 [AMPPZ2014]The Prices(状压dp)
查看>>
Image和Base64互相转换
查看>>
允许远程用户登录访问mysql的方法
查看>>
使用word 2013发布博客到cnblogs设置
查看>>
模数混合电路(模拟、数字电源和地)
查看>>
数据库三大范式
查看>>
Django 后台 无法显示文章标题
查看>>
定时导入数据
查看>>
python基础学习(一)
查看>>
9 .8 . 4 数 据 库 还 原 准 备
查看>>
mac忘记密码的解决办法
查看>>
Eclipse中的引用项目报Could not find *.apk!解决办法
查看>>
amazon的新算法《大数据时代:亚马逊“预判发货”,顾客未动包裹先行》
查看>>
Oracle截取字符串和查找字符串
查看>>
数论 - 欧拉函数的运用 --- poj 3090 : Visible Lattice Points
查看>>
Mininet系列实验(五):Mininet设置带宽之简单性能测试
查看>>