結果
| 問題 | No.289 数字を全て足そう | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-06-16 00:55:46 | 
| 言語 | OCaml (5.2.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 288 bytes | 
| コンパイル時間 | 318 ms | 
| コンパイル使用メモリ | 21,700 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-09 01:20:07 | 
| 合計ジャッジ時間 | 1,202 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
Scanf.scanf "%s" (fun s ->
    let n = String.length s in
    let rec loop i sum =
        if i = n then sum else
            let sum = if s.[i] >= '1' && s.[i] <= '9' then sum + int_of_char s.[i] - 48 else sum in
            loop (i + 1) sum
    in
    loop 0 0 |> Printf.printf "%d\n"
)
            
            
            
        