結果

問題 No.564 背の順
ユーザー r6eve
提出日時 2017-09-08 23:03:25
言語 OCaml
(5.2.1)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 21,832 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-09 00:28:10
合計ジャッジ時間 1,314 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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