Problem:
Score : 100 points

Problem Statement

It is September 9 in Japan now.

You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?

Constraints

10≤N≤99

Input

Input is given from Standard Input in the following format:

N

Output

If 9 is contained in the decimal notation of N, print Yes; if not, print No.

Sample Input 1

29

Sample Output 1

Yes

The one's digit of 29 is 9.

Sample Input 2

72

Sample Output 2

No

72 does not contain 9.

Sample Input 3

91

Sample Output 3

Yes

Solution in OCaml (4.02.3) (judge verdict: Runtime Error)

module CoordComp
  (* 座標の型 *)
  (Coord : sig
    type t
    val compare : t -> t -> int
  end) :
sig
  val compress :
    (* 座標のリスト *)
    Coord.t list ->
    (* 座標の数，圧縮する関数と解凍する関数を返す *)
    int * (Coord.t -> int) * (int -> Coord.t)
end = struct
  module IntMap = Map.Make (struct
    type t = int
    let compare = compare
  end)
  module CoordMap = Map.Make (Coord)
 
  let compress cs =
    let (n, comp, decomp) =
      List.fold_left (fun (n, comp, decomp) c ->
        if CoordMap.mem c comp then (n, comp, decomp)
        else (n + 1, CoordMap.add c n comp, IntMap.add n c decomp))
      (0, CoordMap.empty, IntMap.empty) cs in
    (n, (fun c -> CoordMap.find c comp), (fun n -> IntMap.find n decomp))
end
 
module WeightedDirectedGraph
  (Vertex : sig
    type t
    val compare : t -> t -> int
  end)
  (Weight : sig
    type t
    val zero : t
    val ( + ) : t -> t -> t
    val compare : t -> t -> int
  end) :
sig
  (* 配列版の実装 *)
  val raw_warshall_floyd :
    (* 頂点の数n *)
    int ->
    (* 辺のリスト *)
    (* 頂点は0からn-1まで整数でなくてはならない *)
    (int * int * Weight.t) list ->
    (* 辿り着けなければNoneを返す *)
    (int -> int -> Weight.t option)
 
  (* 座標圧縮により，頂点に様々な型を使えるようにしたバージョン *)
  val warshall_floyd :
    (* 辺のリスト *)
    (Vertex.t * Vertex.t * Weight.t) list ->
    (* 辿り着けなければNoneを返す *)
    (Vertex.t -> Vertex.t -> Weight.t option)
end =
struct
  module CC = CoordComp (Vertex)
 
  let raw_warshall_floyd n es =
    (* 準備 *)
    (* Noneで無限を表す *)
    let d = Array.make_matrix n n None in
    List.iter (fun (u, v, c) -> d.(u).(v) <- Some c) es;
    for v = 0 to n - 1 do
      d.(v).(v) <- Some Weight.zero
    done;
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
        for k = 0 to n - 1 do
          (* d.(j).(k) <- min d.(j).(k) (d.(j).(i) + d.(i).(k)) *)
          let open Weight in
          match d.(j).(k), d.(j).(i), d.(i).(k) with
          | _, None, _ -> ()
          | _, _, None -> ()
          (* d.(j).(k) <= d.(j).(i) + d.(i).(k) *)
          | Some djk, Some dji, Some dik when compare djk (dji + dik) <= 0 -> ()
          | _, Some dji, Some dik -> d.(j).(k) <- Some (dji + dik)
        done
      done
    done;
    fun u v ->
      if u < 0 || n <= u || v < 0 || n <= v
      then None
      else d.(u).(v)
 
  let warshall_floyd es =
    let (n, comp, _) =
      CC.compress @@
        List.concat @@
          List.map (fun (u, v, _) -> [u; v]) es in
    let d =
      raw_warshall_floyd n @@
        List.map (fun (u, v, c) -> (comp u, comp v, c)) es in
    fun u v ->
      try d (comp u) (comp v) with Not_found -> None
end
 
module Int = struct
  type t = int
  let zero = 0
  let ( + ) = ( + )
  let compare = compare
end
 
 
module G = WeightedDirectedGraph (Int) (Int)
 
let rec select acc trace = function
  | [] -> acc
  | x :: xs -> select ((trace, x, xs) :: acc) (x :: trace) xs
let select xs = select [] [] xs
 
let rec permutation = function
  | [] -> [[]]
  | xs -> 
      List.concat @@ List.map (fun (xs, x, ys) -> List.map (fun xs -> x :: xs) (permutation (List.rev_append xs ys)))
      (select xs)
 
let () =
  let n, m, r = Scanf.scanf "%d %d %d\n" (fun n m r -> n, m, r) in
  let rs = Array.to_list @@ Array.init r (fun _ -> Scanf.scanf "%d " (fun r -> r - 1)) in
  let abcs = Array.to_list @@ Array.init m (fun _ -> Scanf.scanf "%d %d %d\n" (fun a b c -> a - 1, b - 1, c)) in
  let d =
    G.warshall_floyd @@
      List.rev_append (List.rev_map (fun (a, b, c) -> (b, a, c)) abcs) abcs in
  permutation rs
  |> List.map (fun (r :: rs) ->
      List.fold_left (fun (r, a) s -> (s, (r, s) :: a)) (r, []) rs
      |> snd
      |> List.map (fun (r, s) ->
          match d r s with
          | None -> max_int
          | Some d -> d)
      |> List.fold_left ( + ) 0)
  |> List.fold_left min max_int
  |> Printf.printf "%d\n"