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;
}
    原文作者:qscqesze
    原文地址: https://www.cnblogs.com/qscqesze/p/5552972.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞