-
Notifications
You must be signed in to change notification settings - Fork 55
/
CSharp.cs
41 lines (33 loc) · 980 Bytes
/
CSharp.cs
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
32
33
34
35
36
37
38
39
40
41
/****************************************/
/* */
/* CodinGame.com Solutions by pathosDev */
/* */
/* Puzzle: Horse-racing Duals */
/* Difficulty: Easy */
/* Date solved: 08.11.2018 */
/* */
/****************************************/
using System;
public class Solution
{
public static void Main()
{
//Read the inputs.
int N = int.Parse(Console.ReadLine());
int[] P = new int[N];
for (int i = 0; i < N; i++)
{
P[i] = int.Parse(Console.ReadLine());
}
//Sort horse strengths.
Array.Sort(P);
//Find D.
int D = int.MaxValue;
for (int i = 1; i < N; i++)
{
D = Math.Min(D, P[i] - P[i - 1]);
}
//Print D.
Console.WriteLine(D);
}
}