#CCBCHBA0000048. Vanya and Fence (Vanya and Fence)
Vanya and Fence (Vanya and Fence)
Vanya and Fence
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Each of n people has height ai. A person with ai<=h needs width 1; otherwise width 2. Find total required width.
Input
1<=n,h<=1000 followed by n heights satisfying 1<=ai<=2h.
Output
One integer: total width.
Subtasks
- Subtask 1 (20%): n<=5, h<=10, 1<=ai<=2h.
- Subtask 2 (30%): n<=100,h<=100, 1<=ai<=2h.
- Subtask 3 (50%): n<=1000,h<=1000, 1<=ai<=2h.
Examples
Example 1
Input
3 7
4 5 14
Output
4
Explanation
Widths 1+1+2=4.
Example 2
Input
2 5
5 6
Output
3
Explanation
Height equal to h uses width one.