博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CodeForces 1102C
阅读量:7208 次
发布时间:2019-06-29

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

https://vjudge.net/problem/2135718/origin

You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move.

There are nn doors, the ii -th door initially has durability equal to aiai .

During your move you can try to break one of the doors. If you choose door ii and its current durability is bibi then you reduce its durability to max(0,bix)max(0,bi−x) (the value xx is given).

During Slavik's move he tries to repair one of the doors. If he chooses door ii and its current durability is bibi then he increases its durability to bi+ybi+y (the value yy is given). Slavik cannot repair doors with current durability equal to 00 .

The game lasts 1010010100 turns. If some player cannot make his move then he has to skip it.

Your goal is to maximize the number of doors with durability equal to 00 at the end of the game. You can assume that Slavik wants to minimize the number of such doors. What is the number of such doors in the end if you both play optimally?

Input

The first line of the input contains three integers nn , xx and yy (1n1001≤n≤100 , 1x,y1051≤x,y≤105 ) — the number of doors, value xx and value yy , respectively.

The second line of the input contains nn integers a1,a2,,ana1,a2,…,an (1ai1051≤ai≤105 ), where aiai is the initial durability of the ii -th door.

Output

Print one integer — the number of doors with durability equal to 00 at the end of the game, if you and Slavik both play optimally.

Examples

Input
6 3 22 3 1 3 4 2
Output
6
Input
5 3 31 2 4 2 3
Output
2
Input
5 5 61 2 6 10 3
Output
2

Note

Clarifications about the optimal strategy will be ignored

这个题目的意思就是有两个人,一个是破坏门的,另一个就是修复门的,破坏的人攻击一下门,门的耐力值会减少x,修复门的修复一下,门的耐力值会增加y,如果门的耐力值小于x,那么门的耐力值会变成0,

变成0的门是不能修复的。题目就是要你求出在他们两个人都没有任何的失误的情况下,会有多少个变成0的门。

#include
#include
int main(){ int n,x,y,a[150],sum; while(~scanf("%d%d%d",&n,&x,&y)) { sum=0; for(int i=1;i<=n;i++) scanf("%d",&a[i]); if(x>y)//如果攻击大于修复那么只要进行下去所以的门就都会变成0; printf("%d\n",n); if(x<=y) { for(int i=1;i<=n;i++)//如果攻击小于修复,因为他们是轮着来的,所以他们就是在门的初始值就小于x的门里面攻击和修复。 { if(a[i]<=x) sum++; } if(sum%2==0)//只要破坏了就不能修复,只要修复了就不能破坏。 printf("%d\n",sum/2); else printf("%d\n",(sum+1)/2); } } return 0;}

 

转载于:https://www.cnblogs.com/135jsk/p/10294748.html

你可能感兴趣的文章
flask with gae开发小结
查看>>
以打字形式展示placeholder的插件
查看>>
http文件导出写文件
查看>>
Globus的简单介绍
查看>>
[LeetCode] Search Insert Position 解题报告
查看>>
c# 的传递参数值传递与传递引用的区别,ref与out区别
查看>>
win7+vs2008+cuda5.x 环境配置二
查看>>
PHP5.5安装PHPRedis扩展
查看>>
c#Socket Tcp服务端编程
查看>>
java构造函数注意点
查看>>
Asp.net 中配置 CKEditor和CKFinder
查看>>
Use dynamic type in Entity Framework 4.1 SqlQuery() method
查看>>
《Python CookBook2》 第四章 Python技巧 - 若列表中某元素存在则返回之 && 在无须共享引用的条件下创建列表的列表...
查看>>
redhat网卡设置
查看>>
javascript 的作用域
查看>>
JFinal极速开发框架使用笔记(二) 两个问题,一个发现
查看>>
AutoCompleteTextView
查看>>
SecureCRT生成序列
查看>>
Android 应用程序主框架搭建
查看>>
2012腾讯春季实习生面试经历(二)
查看>>