Problem 677A Vanya and Fence (Codeforces 800)

Vanya和他的朋友们正沿着高度为h的栅栏行走,为了避免被守卫发现,每个人的高度不应超过h。如果某人的身高超过h,他可以弯腰,这样就不会被看见。朋友们希望并排行走进行交谈,求最小宽度的路面,使得他们能排列成一行并避开守卫的注意。输入包含朋友人数n和栅栏高度h,以及每个人的身高ai。输出是最小的可行路面宽度。解决方案是根据身高是否超过栅栏高度来累加路面宽度,若超过则加2,否则加1。

Vanya and Fence

Vanya and his friends are walking along the fence of height hhh and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than hhh he can bend down and then he surely won’t be noticed by the guard. The height of the iii-th person is equal to aaai.

Consider the width of the person walking as usual to be equal to 111, while the width of the bent person equals 222. Friends want to talk to each other while walking, so they would like to walk in a single row. What is the minimum width of the road, such that friends can walk in a row and remain unattended by the guard?

Input

The first line of the input contains two integers n and h (

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值