結果

問題 No.163 cAPSlOCK
コンテスト
ユーザー maimai8
提出日時 2020-08-05 11:33:22
言語 OCaml
(5.4.1)
コンパイル:
ocamlfind ocamlopt -linkpkg -package zarith,str _filename_ -o a.out
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 473 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 206 ms
コンパイル使用メモリ 22,668 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-25 05:23:55
合計ジャッジ時間 1,639 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

let () =
  let rec charlist_of_string str n i =
    if i = n then [] else str.[i] :: charlist_of_string str n (i+1) in
  let rec convert lst = match lst with
    | [] -> ""
    | h :: t ->
      if h = Char.lowercase_ascii h then (Char.escaped (Char.uppercase_ascii h)) ^ convert t
      else (Char.escaped (Char.lowercase_ascii h)) ^ convert t in
  Scanf.scanf "%s\n" @@ fun s ->
  let lst = charlist_of_string s (String.length s) 0 in
  Printf.printf "%s\n" (convert lst)
0