結果
| 問題 |
No.1070 Missing a space
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-14 00:11:30 |
| 言語 | OCaml (5.2.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 382 bytes |
| コンパイル時間 | 391 ms |
| コンパイル使用メモリ | 20,852 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-09 01:01:50 |
| 合計ジャッジ時間 | 842 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
let solve str =
let len_str = String.length str in
let rec solve' idx acc =
if idx >= len_str then
acc
else
let idx' = idx + 1
and acc' = if str.[idx] = '0' then acc else acc + 1
in
solve' idx' acc'
in
solve' 1 0
let () =
let str = read_line () in
Printf.printf "%d\n" @@ solve str