結果

問題 No.113 宝探し
ユーザー maimai8maimai8
提出日時 2020-08-03 15:55:36
言語 OCaml
(5.1.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 426 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 21,448 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 09:08:17
合計ジャッジ時間 1,188 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
File "Main.ml", lines 7-8, characters 22-84:
7 | ......................match s with
8 |          | 'N' -> (x,y+.1.) | 'E' -> (x+.1.,y) | 'W' -> (x-.1.,y) | 'S' -> (x,y-.1.)................
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
'a'

ソースコード

diff #

let () =
  let rec charlist_of_string str n i =
    if i = n then [] else str.[i] :: charlist_of_string str n (i+1) in
  Scanf.scanf "%s\n" @@ fun s ->
  let lst = charlist_of_string s (String.length s) 0 in
  let (x,y) = List.fold_left 
      (fun (x,y) s -> match s with
         | 'N' -> (x,y+.1.) | 'E' -> (x+.1.,y) | 'W' -> (x-.1.,y) | 'S' -> (x,y-.1.)) (0.,0.) lst in
  Printf.printf "%.5f\n" (sqrt (x ** 2. +. y ** 2.))
0