結果
| 問題 |
No.505 カードの数式2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-14 18:56:00 |
| 言語 | OCaml (5.2.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 547 bytes |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 19,692 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 00:01:39 |
| 合計ジャッジ時間 | 1,494 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 19 |
ソースコード
let solve a_lst =
let rec solve' lst result =
match lst with
| [] -> result
| x::xs ->
let result =
match x with
| n when n < 0 -> result - x
| 0 | 1 -> result + x
| _ -> result * x
in
solve' xs result
in
match a_lst with
| x::xs -> solve' xs x
| _ -> failwith "hoge"
let () =
let _ = read_line ()
and a_lst = read_line ()
|> Str.split (Str.regexp_string " ")
|> List.map int_of_string
in
solve a_lst
|> string_of_int
|> print_endline