結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-03 15:55:36 |
| 言語 | OCaml (5.2.1) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 426 bytes |
| コンパイル時間 | 447 ms |
| コンパイル使用メモリ | 21,700 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 01:54:37 |
| 合計ジャッジ時間 | 1,412 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
コンパイルメッセージ
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'
ソースコード
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.))