-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathTheHurdleRace.java
More file actions
24 lines (22 loc) · 657 Bytes
/
Copy pathTheHurdleRace.java
File metadata and controls
24 lines (22 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] height = new int[n];
int maxHeight = 5;
int drinks=0;
for(int height_i=0; height_i < n; height_i++){
height[height_i] = in.nextInt();
if(height[height_i] > maxHeight)
maxHeight = height[height_i];
}
drinks = (maxHeight>k)?(maxHeight-k):0;
System.out.println(drinks);
}
}