emu in blogjava

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            171 隨筆 :: 103 文章 :: 1052 評論 :: 2 Trackbacks
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          公告

          常用鏈接

          留言簿(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 閱讀(1448) 評論(0)  編輯  收藏 所屬分類: google編程大賽模擬題及入圍賽真題
          主站蜘蛛池模板: 永康市| 犍为县| 大竹县| 沁源县| SHOW| 衡阳市| 湄潭县| 新昌县| 黔西县| 清河县| 襄城县| 邛崃市| 泾川县| 瑞安市| 九江市| 老河口市| 隆德县| 威宁| 曲麻莱县| 麦盖提县| 贺兰县| 城固县| 信宜市| 南康市| 内丘县| 金昌市| 县级市| 丰城市| 锡林郭勒盟| 天长市| 大荔县| 长乐市| 伊宁县| 吴江市| 普安县| 张家口市| 永顺县| 班戈县| 紫云| 铜山县| 上栗县|