博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
阅读量:4684 次
发布时间:2019-06-09

本文共 1438 字,大约阅读时间需要 4 分钟。

A. Vanya and Fence

题目连接:

Description

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

The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively.

The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.

Output

Print a single integer — the minimum possible valid width of the road.

Sample Input

3 7

4 5 14

Sample Output

4

Hint

题意

身高不超过h的话,一般只会占1的宽度,超过的话,体型占2的宽度

问你n个人,要站成一排的话,最少要多少宽度

题解:

水题……

代码

#include
using namespace std;int n,h,x,ans;int main(){ scanf("%d%d",&n,&h); for(int i=1;i<=n;i++) { scanf("%d",&x); ans++; if(x>h)ans++; } cout<
<

转载于:https://www.cnblogs.com/qscqesze/p/5552972.html

你可能感兴趣的文章
Linux发展历程
查看>>
centos7.3下curl支持https协议
查看>>
ASPCMS 标签
查看>>
《C++ Primer 4th》读书笔记 第12章-类
查看>>
Mac下搭建Apache+PHP+MySql运行环境
查看>>
WCF消息传递
查看>>
测试准入准出标准
查看>>
区块链学习笔记01(基本介绍)
查看>>
[树形dp] 洛谷 P2634 聪聪可可
查看>>
The version of SQL Server in use does not support datatype 'datetime2' 解决办法
查看>>
JAVA基础知识之网络编程——-网络基础(Java的http get和post请求,多线程下载)...
查看>>
DSAPI多功能组件编程应用-HTTP监听服务端与客户端_指令版
查看>>
Java中的ReentrantLock和synchronized两种锁定机制的对比
查看>>
MySQL锁之二:锁相关的配置参数
查看>>
作品汇总和进度表
查看>>
2018-2019-1 20165301 《信息安全系统设计基础》第五周学习总结
查看>>
EF多个表映射
查看>>
J2EE项目集成SAP的BO报表
查看>>
SpringBoot常用属性配置
查看>>
linux sdcv命令
查看>>