結果

問題 No.499 7進数変換
コンテスト
ユーザー ichibanshibori
提出日時 2017-04-15 23:56:13
言語 OCaml
(5.5.0)
コンパイル:
ocamlfind ocamlopt -linkpkg -package zarith,str _filename_ -o a.out
実行:
./a.out
結果
WA  
実行時間 -
コード長 431 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 104 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-12 07:09:36
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf

ソースコード

diff #
raw source code

let to_string lst =
  let zero_asc = int_of_char '0'
  and len = List.length lst
  in
  String.init len (fun i -> char_of_int (zero_asc + (List.nth lst i)))

let solve n =
  let rec solve' m result =
    if m <= 0 then result
    else
      let d = m / 7
      and r = m mod 7
      in
      solve' d (r :: result)
  in
  solve' n []
  |> to_string

let () =
  let n = read_line () |> int_of_string in
  solve n
  |> print_endline
0