Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
A. Vanya and Fence
题目连接:
http://www.codeforces.com/contest/677/problem/A
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<bits/stdc++.h>
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<<ans<<endl;
}
Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题的更多相关文章
- Codeforces Round #355 (Div. 2) C. Vanya and Label 水题
C. Vanya and Label 题目连接: http://www.codeforces.com/contest/677/problem/C Description While walking d ...
- Codeforces Round #308 (Div. 2) D. Vanya and Triangles 水题
D. Vanya and Triangles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55 ...
- Codeforces Round #280 (Div. 2) A. Vanya and Cubes 水题
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题
B. Vanya and Food Processor 题目连接: http://www.codeforces.com/contest/677/problem/B Description Vanya ...
- Codeforces Round #290 (Div. 2) A. Fox And Snake 水题
A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...
- Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题
A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...
- Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题
B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos 水题
A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...
随机推荐
- Add Two Numbers I & II
Add Two Numbers I You have two numbers represented by a linked list, where each node contains a sing ...
- MySQL数据记录大小写敏感问题【转】
MySQL大小写敏感 字符串大小写敏感和Mysql的数据库的名字.表名字.字段名字.还有字段值有关. 1.和数据库名字.表名字.存储过程和触发器有关 为0时:表示区分大小写,使用CREATE TABL ...
- C# 调用WSDL接口及方法
1.首先需要清楚WSDL的引用地址 如:http://XX.XX.4.146:8089/axis/services/getfileno?wsdl 上述地址的构造为 类名getfileno. 2.在.N ...
- shell 指令分析nginx 日志qps
实时分析 tail -f points.api.speiyou.cn.access.log|awk 'BEGIN{key="";cnt=0}{if(key==$5){cnt++}e ...
- ADB安装
1,下载解压 http://adbshell.com/downloads 2,配置路径 比如解压后我放在了C:\Program Files\adb 电脑-->属性-->高级系统设置--&g ...
- Android studio 安装过程中遇到的问题
之前用eclipse,想换下studio试试,安装时遇到问题,参考:http://www.cnblogs.com/csulennon/p/4178404.html
- Jenkins 集成 Sonar
Jenkins 与 Sonar 集成:Sonar 是 Jenkins 之外独立运行的一个服务.Jenkins 中安装插件 SonarQube(并配置其 Sonar Server 的 URL / Acc ...
- Rewrite HTTP to HTTPS in Nginx
1.推荐配置 server { listen 80; server_name example1.com example2.com; return 301 https://$host$request_u ...
- git clone 某个分支或者所有分支
clone 某个分支: git clone -b dev5 https://git.coding.net/aiyongbao/tradepc.git clone 所有分支: git cl ...
- FlumeNG介绍及安装部署
本节内容: Flume简介 Flume NG核心组件 Flume部署种类 Flume单机安装 一.Flume简介 Flume是一个分布式.可靠.高可用的海量日志聚合系统,支持在系统中定制各类数据发送方 ...