let ``No.716 距離``() = stdin.ReadLine() |> int |> fun n -> let an = stdin.ReadLine().Split(' ') |> Array.map (int) |> Array.toList |> List.sort let rec loop prev minimum lt = match lt with | [] -> 0 | [x] -> if abs(x-prev) < minimum then abs(x-prev) else minimum | x::xs-> let m = if abs(x-prev) < minimum then abs(x-prev) else minimum loop x m xs stdout.WriteLine (loop 999999 999999 an) ( List.max an - List.min an )|> abs |> stdout.WriteLine () ``No.716 距離``()