emu in blogjava

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            171 隨筆 :: 103 文章 :: 1052 評論 :: 2 Trackbacks
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          公告

          常用鏈接

          留言簿(92)

          隨筆分類(20)

          隨筆檔案(171)

          文章分類(89)

          文章檔案(103)

          相冊

          收藏夾(46)

          友情連接

          收藏

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          Problem Statement
          ????
          You want to buy two neighboring tickets in the first row of the theater so that one of the tickets is as far from the aisles as possible.
          You will be given a String describing the first row of the theater where '.' represents an empty seat and 'X' represents an occupied seat. Your task is to return the index (from 0) of the empty seat that is furthest from the aisles (the two ends of the String) and is also next to an empty seat. If there are multiple possible seats, return the one with the smallest index. Return -1 if there are no seats that satisfy your requirements.
          Definition
          ????
          Class:
          TheaterVisit
          Method:
          chooseSeat
          Parameters:
          String
          Returns:
          int
          Method signature:
          int chooseSeat(String row)
          (be sure your method is public)
          ????

          Constraints
          -
          row will contain between 1 and 50 characters, inclusive.
          -
          Each character in row will be either '.' or 'X'.
          Examples
          0)

          ????
          "....."
          Returns: 2
          You can buy either tickets with indexes 1 and 2 or tickets with indexes 2 and 3.
          1)

          ????
          "......"
          Returns: 2

          2)

          ????
          "..X..."
          Returns: 3
          You should buy tickets with indexes 3 and 4.
          3)

          ????
          ".X.X..."
          Returns: 4

          4)

          ????
          "X.XX.X"
          Returns: -1

          5)

          ????
          ".."
          Returns: 0

          This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.

          posted on 2005-12-20 10:27 emu 閱讀(1446) 評論(0)  編輯  收藏 所屬分類: google編程大賽模擬題及入圍賽真題
          主站蜘蛛池模板: 镇巴县| 辽阳市| 宜都市| 中宁县| 乌拉特前旗| 武清区| 九龙县| 从化市| 皋兰县| 泰宁县| 商水县| 东平县| 独山县| 比如县| 桃园市| 鞍山市| 天祝| 景东| 丘北县| 施秉县| 永新县| 汶上县| 山阴县| 凤城市| 思茅市| 茌平县| 吉木萨尔县| 鄂托克前旗| 买车| 株洲市| 娱乐| 安义县| 桂平市| 汉沽区| 灵山县| 贵州省| 景东| 泽州县| 华安县| 宁明县| 高要市|