Descirbe

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 n doors, the i-th door initially has durability equal to ai.

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

During Slavik’s move he tries to repair one of the doors. If he chooses door i and its current durability is bi then he increases its durability to bi+y (the value y is given). Slavik cannot repair doors with current durability equal to 0.

The game lasts 10100 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 0 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 n, x and y (1≤n≤100, 1≤x,y≤105) — the number of doors, value x and value y, respectively.

The second line of the input contains n integers a1,a2,…,an (1≤ai≤105), where ai is the initial durability of the i-th door.

Output

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

Examples

inputCopy

6 3 2

2 3 1 3 4 2

outputCopy

6

inputCopy

5 3 3

1 2 4 2 3

outputCopy

2

inputCopy

5 5 6

1 2 6 10 3

outputCopy

2

Note

Clarifications about the optimal strategy will be ignored.

题意大概是两个人玩游戏一个警察,一个坏蛋,一个人破门,一个人补门,警察像破开尽可能多的门,坏蛋想让警察破开门尽可能少,这时候就疑惑了,这到底是让我们求最大值,还是最小值?在这里我们看到,两个人的意愿也改变不了必然的结果,就拿这一组数据

6 3 2

2 3 1 3 4 2

6扇门,警察破门掉 3个耐久,坏蛋修门增加2个耐久,警察与坏蛋轮流操作,警察为破开更多的们,会选择第一次就能破开,或者说最小耐久值的门,坏蛋也是这样想的,他会修补那些一次就被警察破门的门,前提是坏蛋增加耐久大于警察破门,不然以题目这样的数据,一直撞迟早也是撞开的,当坏蛋修补增加的耐久大于警察撞门耐久时,便有了以下操作

5 5 6

1 2 6 10 3

警察第一次撞门 1

坏蛋第一次修门 2

警察第二次撞门 3

再往后警察一次撞不开一扇门,而坏蛋使门的耐久度越来越高,这就得出了必然的结果。

下面是AC code

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int x,y,n,a[10000],s;
while(cin>>n>>x>>y)
{
s=0;
for(int i=1;i<=n;i++)
cin>>a[i];
if(x>y)
{
cout<<n<<endl;
}
else if(x<=y)
{
sort(a+1,a+1+n);
int w=1;
for(int i=1;i<=n;i++)
{
if(a[i]<=x)
s++;
}
if(s%2==1) s=s/2+1;
else s=s/2;
cout<<s<<endl;
}
}
}

Codeforce 1102 C. Doors Breaking and Repairing的更多相关文章

  1. Doors Breaking and Repairing

    题目链接:Doors Breaking and Repairing 题目大意:有n个门,先手攻击力为x(摧毁),后手恢复力为y(恢复),输入每个门的初始“生命值”,当把门的生命值攻为0时,就无法恢复了 ...

  2. Doors Breaking and Repairing CodeForces - 1102C (思维)

    You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consi ...

  3. Codeforces Round #531 (Div. 3) C. Doors Breaking and Repairing (博弈)

    题意:有\(n\)扇门,你每次可以攻击某个门,使其hp减少\(x\)(\(\le 0\)后就不可修复了),之后警察会修复某个门,使其hp增加\(y\),问你最多可以破坏多少扇门? 题解:首先如果\(x ...

  4. Codeforces Round #531 (Div. 3) ABCDEF题解

    Codeforces Round #531 (Div. 3) 题目总链接:https://codeforces.com/contest/1102 A. Integer Sequence Dividin ...

  5. Reinvent the Wheel Often

    Reinvent the Wheel Often Jason P. Sage Just use something that exists-it's silly to reinvent the whe ...

  6. How can I protect derived classes from breaking when I change the internal parts of the base class?

    How can I protect derived classes from breaking when I change the internal parts of the base class? ...

  7. poj 1102.LC-Display 解题报告

    题目链接:http://poj.org/problem?id=1102 题目意思:就是根据给出的格式 s 和 数字 n,输出数值 n 的 LCD 显示.数值 n 的每个数字要占据 s + 2 列 和 ...

  8. Codeforce - Street Lamps

    Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is ...

  9. HDU 1102 最小生成树裸题,kruskal,prim

    1.HDU  1102  Constructing Roads    最小生成树 2.总结: 题意:修路,裸题 (1)kruskal //kruskal #include<iostream> ...

随机推荐

  1. Vulnhub bulldog靶机渗透

    配置 VM运行kali,桥接模式设置virtualbox. vbox运行靶机,host-only网络. 信息搜集 nmap -sP 192.168.56.0/24 或者 arp-scan -l #主机 ...

  2. 2017蓝桥杯取位数(C++B组)

    题目: 标题:取数位求1个整数的第k位数字有很多种方法.以下的方法就是一种.// 求x用10进制表示时的数位长度 int len(int x){ if(x<10) return 1; retur ...

  3. Flask 入门(六)

    连接数据库 任何一门后端语言都可以连接数据库,python-flask也不例外 flask利用SQLAlchemy ORM连接数据库 接下来,我门来练习如何连接数据库: 1.首先,电脑上得有mysql ...

  4. 文件的读写 - open

    #写文件,r路径\n 空格\t 缩进# fan=open(r'C:/Users/demiyangping_v/Desktop/fan.txt','w', encoding='utf-8')# fan. ...

  5. eclipse 使用 快捷键

    ctrl + t :查看类的子类和实现类 ctrl + o 查看类实现的方法 ctrl + 1 相当于idea的 alt + enter 补全变量 syso 点  alt + / System.out ...

  6. javascript - 所有的视图属性和方法(offsetHeight、clientHeight、scrollHeight、innerHeight等)

    注意:本文只简单的介绍了各个视图的属性和方法.如果想要知道兼容性或者更多,请至文章底部参考链接处. 本文内容分为五大部分: Window视图属性 innerHeight 和 innerWidth ou ...

  7. 2、使用断言(json assertion)

    1.假设现在有一个服务端的返回数据(需要测试的)为:HTTP/1.1 200 OK,要测试的响应字段勾选Response Headers,模式匹配规则选择Substring,把该响应断言命名为Http ...

  8. Linux下搭建接口自动化测试平台

    前言 我们今天来学习一下在Linux下如何搭建基于HttpRunner开发的接口自动化测试平台吧! 需要在Linux上提前准备的环境(下面是本人搭建时的环境): 1,Python 3.6.8 (可参考 ...

  9. day01,了解gcc

    今天主要是学一下gcc 功能选项: 一. 1.  gcc -E:表示预处理,把指令处理掉 2.gcc -o:改变目标文件名称 3. gcc -c: 表示只编译不链接(也就是不生成a.out) 4. g ...

  10. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之九(四十五)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...