結果

問題 No.564 背の順
ユーザー r6eve
提出日時 2017-09-08 22:53:53
言語 OCaml
(5.2.1)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 00:27:47
合計ジャッジ時間 1,115 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  let h, n = Scanf.scanf "%d %d " (fun h n -> h, n) in
  let n = n - 1 in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in
  Array.fast_sort (fun x y -> y - x) a;
  let rec doit i =
    if i = n || h >= a.(i) then i + 1
    else doit (i + 1) in
  let i = doit 0 in
  if i = 1 then print_endline "1st"
  else if i = 2 then print_endline "2nd"
  else if i = 3 then print_endline "3rd"
  else Printf.printf "%dth\n" i
0