DAY4.2 C. Doors Breaking and Repairing

C. Doors Breaking and Repairing

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 (1≤n≤1001≤n≤100, 1≤x,y≤1051≤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 (1≤ai≤1051≤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.

思路&过程

废话不多说了,直接看代码吧,我倦了。。。
宝宝想睡觉。。。

#include <iostream> 
using namespace std; 
int main() 
{ 
	int n,a,b,c; 
	int d[200]; 
	int t=0; 
	cin>>n>>a>>b; 
	int ans=0; 
	for(int i=0;i<n;i++){ 
		cin>>c; 
		if(c<=a) ans++; 
		else d[t++]=c; 
	} 
	if(a>b) cout<<n<<endl; 
	else{ 
		if(ans%2==1) ans++; 
		cout<<ans/2<<endl;
	} 
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要下载Doors手机版,你可以按照以下步骤进行操作: 1. 打开手机应用商店:无论是苹果App Store还是安卓的Google Play商店,你都可以在手机主屏或应用列表中找到它们。 2. 搜索Doors:在应用商店的搜索栏中输入“Doors”,然后点击搜索按钮进行查找。 3. 选择正确的应用:在搜索结果中,找到“Doors”应用,确保它是由官方开发者发布的,并且与你的手机系统兼容。 4. 点击下载/安装:点击“下载”或“安装”按钮,手机会开始下载并安装Doors应用。确保你的手机连接到互联网,并保持稳定的网络连接。 5. 等待安装完成:下载与安装过程需要一些时间,具体时间取决于你的网络速度和手机性能。请耐心等待直到安装完成。 6. 启动应用:一旦安装完成,你可以在手机主屏或应用列表中找到Doors图标。点击图标启动应用。 7. 登录或注册账号:在应用开始界面,你可能需要登录或注册一个Doors账号。如果已经有账号,直接输入你的用户名和密码进行登录;如果没有账号,则需要点击注册进行账号创建。 8. 使用Doors:完成登录/注册后,你就可以开始使用Doors手机版了。探索各种功能和内容,享受这款应用带来的便利与乐趣。 请注意,在下载任何应用之前,请确保你的手机满足该应用的最低系统要求,并且只从正规的应用商店下载应用,以保证安全性和可用性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值