CF 677A Vanya and Fence

这篇博客介绍了Codeforces竞赛中的一道题目——677A Vanya and Fence。问题涉及到计算在确保所有人不被高为h的篱笆上的守卫发现的情况下,一行人最小可能的宽度。输入包括朋友的数量n和篱笆的高度h,以及每个朋友的高度ai。解题策略是计算需要弯腰的人数,弯腰时宽度为2,站立时宽度为1,最后输出总宽度。
摘要由CSDN通过智能技术生成

题目地址:http://codeforces.com/problemset/problem/677/A
A. Vanya and Fence
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Vanya and his friends are walking along the fence of height h 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 h he can bend down and then he surely won’t be noticed by the guard. The height of the i-th person is equal to ai.

Consider the width of the person walking as usual to be equal to 1, while the width of the bent person is equal to 2. 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
Th

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值