結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー r6eve
提出日時 2017-08-17 10:28:48
言語 OCaml
(5.2.1)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 19,816 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 00:23:51
合計ジャッジ時間 1,188 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

let chr_to_num c = Char.code c - Char.code '0'

let p s =
  let n = String.length s in
  let x = chr_to_num s.[0] in
  if n <> 1 && (x < 1 || x > 9) then false
  else
    let rec doit i =
      if i = n then true
      else
        let x = chr_to_num s.[i] in
        if x < 0 || x > 9 then false
        else doit (i + 1) in
    doit 1

let () =
  let a = read_line () in
  let b = read_line () in
  print_endline (if p a && p b then "OK" else "NG")
0