結果

問題 No.1131 Deviation Score
ユーザー eseharaesehara
提出日時 2021-06-01 22:48:58
言語 OCaml
(5.1.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 644 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 19,956 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-26 09:55:42
合計ジャッジ時間 3,709 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
5,248 KB
testcase_01 AC 4 ms
5,248 KB
testcase_02 AC 151 ms
10,752 KB
testcase_03 AC 69 ms
6,016 KB
testcase_04 AC 142 ms
10,368 KB
testcase_05 AC 51 ms
5,760 KB
testcase_06 AC 152 ms
10,752 KB
testcase_07 AC 69 ms
6,144 KB
testcase_08 AC 131 ms
9,488 KB
testcase_09 AC 48 ms
5,376 KB
testcase_10 AC 125 ms
9,216 KB
testcase_11 AC 131 ms
9,600 KB
testcase_12 AC 118 ms
7,936 KB
testcase_13 AC 147 ms
10,624 KB
testcase_14 AC 31 ms
5,376 KB
testcase_15 AC 29 ms
5,376 KB
testcase_16 AC 136 ms
9,760 KB
testcase_17 AC 54 ms
5,760 KB
testcase_18 AC 171 ms
11,136 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let split_on_char sep s =
  let r = ref [] in
  let j = ref (String.length s) in
  for i = String.length s - 1 downto 0 do
    if String.unsafe_get s i = sep then begin
      r := String.sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  String.sub s 0 !j :: !r;;

let hensati a x = int_of_float (50. -. ((a -. x) /. 2.));;

let () =
  let n = read_line () |> int_of_string in
  let seito = read_line () |> split_on_char ' ' |> List.map int_of_string in
  let heikin = (float_of_int (List.fold_left (+) 0 seito)) /. (float_of_int n) in
  List.iter (fun x -> hensati heikin (float_of_int x) |> print_int; print_newline ()) seito;;
0