码迷,mamicode.com
首页 > 其他好文 > 详细

CodeForces 1102C

时间:2019-01-20 14:57:42      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:strategy   bsp   element   scan   cti   sample   man   atom   red   

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,bi?x)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 2
2 3 1 3 4 2
Output
6
Input
5 3 3
1 2 4 2 3
Output
2
Input
5 5 6
1 2 6 10 3
Output
2

Note

Clarifications about the optimal strategy will be ignored

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

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

#include<stdio.h>
#include<string.h>
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;
} 

 

CodeForces 1102C

标签:strategy   bsp   element   scan   cti   sample   man   atom   red   

原文地址:https://www.cnblogs.com/135jsk/p/10294748.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!