-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCCC18S1.java
31 lines (31 loc) · 1.02 KB
/
CCC18S1.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* CCC '18 S1 - Voronoi Villages
* Question type: Implementation
* 15/15 on DMOJ
* Question URL: https://dmoj.ca/problem/ccc18s1
* @author Tommy Pang
*/
public class CCC18S1 {
static StringTokenizer st;
static int [] arr;
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException{
int N = Integer.parseInt(br.readLine());
arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = Integer.parseInt(br.readLine());
}
Arrays.sort(arr);
double min = 1e10;
for (int i = 1; i < N-1; i++) {
double size = (double) (arr[i] - arr[i-1])/2 + (double) (arr[i+1] - arr[i])/2;
min = Math.min(size, min);
}
System.out.println(String.format("%.1f", min));
}
}