結果
問題 | No.21 平均の差 |
ユーザー | guricerin |
提出日時 | 2020-01-09 10:39:06 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 65 ms / 5,000 ms |
コード長 | 979 bytes |
コンパイル時間 | 5,857 ms |
コンパイル使用メモリ | 168,400 KB |
実行使用メモリ | 24,504 KB |
最終ジャッジ日時 | 2023-08-15 01:10:09 |
合計ジャッジ時間 | 7,526 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 63 ms
24,476 KB |
testcase_01 | AC | 63 ms
22,448 KB |
testcase_02 | AC | 64 ms
22,444 KB |
testcase_03 | AC | 63 ms
22,584 KB |
testcase_04 | AC | 64 ms
24,436 KB |
testcase_05 | AC | 62 ms
22,444 KB |
testcase_06 | AC | 65 ms
22,432 KB |
testcase_07 | AC | 65 ms
24,504 KB |
testcase_08 | AC | 65 ms
22,568 KB |
testcase_09 | AC | 63 ms
20,380 KB |
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
ソースコード
open System open System.Collections.Generic [<AutoOpen>] module Cin = let read f = stdin.ReadLine() |> f let reada f = stdin.ReadLine().Split() |> Array.map f let readChars() = read string |> Seq.toArray let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString())) [<AutoOpen>] module Cout = let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput())) let print (s: string) = writer.Write s let println (s: string) = writer.WriteLine s let inline puts (s: ^a) = string s |> println let solve() = let n = read int let k = read int let vs = Array.zeroCreate n for i in 0 .. n - 1 do vs.[i] <- read int let vs = Array.sort vs let nax = vs.[n - 1] let nin = vs.[0] let ans = nax - nin ans |> puts () [<EntryPoint>] let main _ = try solve() with e -> printfn "%s" (e.ToString()) writer.Close() 0 // return an integer exit code