結果

問題 No.1134 Deviation Score Ⅱ
ユーザー xsdxsd
提出日時 2020-08-15 18:18:02
言語 OCaml
(5.1.0)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 21,580 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2024-04-17 09:10:14
合計ジャッジ時間 2,120 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 21 ms
6,656 KB
testcase_02 AC 15 ms
6,528 KB
testcase_03 AC 17 ms
6,272 KB
testcase_04 AC 9 ms
6,144 KB
testcase_05 AC 20 ms
6,656 KB
testcase_06 AC 7 ms
6,016 KB
testcase_07 AC 6 ms
6,016 KB
testcase_08 AC 17 ms
6,528 KB
testcase_09 AC 6 ms
5,760 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 15 ms
6,272 KB
testcase_12 AC 14 ms
6,272 KB
testcase_13 AC 21 ms
6,656 KB
testcase_14 AC 15 ms
6,272 KB
testcase_15 AC 12 ms
6,144 KB
testcase_16 AC 7 ms
6,144 KB
testcase_17 AC 15 ms
6,144 KB
testcase_18 AC 16 ms
6,272 KB
testcase_19 AC 18 ms
6,528 KB
testcase_20 AC 12 ms
6,016 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d" (fun n ->
    let x = Array.init n (fun _ -> Scanf.scanf " %f" (fun x -> x)) in
    let xs = Array.fold_left (+.) 0. x in
    let av = xs /. float n in
    let rec loop i acc =
        if i = n then sqrt (acc /. float n) else
            let acc = acc +. (x.(i) -. av) *. (x.(i) -. av) in
            loop (i + 1) acc
    in
    let sq = loop 0 0. in

    Scanf.scanf " %d" (fun m ->
        let ans = int_of_float (floor (10. *. (x.(m - 1) -. av) /. sq +. 50.)) in
        Printf.printf "%d\n" ans
    )
)
0