<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Java Votary

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      48 隨筆 :: 1 文章 :: 80 評論 :: 0 Trackbacks
    Google編程大賽入圍賽250分真題


    Problem Statement
    ????
    You are given a String[] cityMap representing the layout of a city. The city
    consists of blocks. The first element of cityMap represents the first row of
    blocks, etc. A 'B' character indicates a location where there is a bus stop.
    There will be exactly one 'X' character, indicating your location. All other
    characters will be '.'. You are also given an int walkingDistance, which is the
    maximum distance you are willing to walk to a bus stop. The distance should be
    calculated as the number of blocks vertically plus the number of blocks
    horizontally. Return the number of bus stops that are within walking distance of
    your current location. Definition
    ????
    Class:
    BusStops
    Method:
    countStops
    Parameters:
    String[], int
    Returns:
    int
    Method signature:
    int countStops(String[] cityMap, int walkingDistance)
    (be sure your method is public)
    ????

    Constraints
    -
    cityMap will contain between 1 and 50 elements, inclusive.
    -
    Each element of cityMap will contain between 1 and 50 characters, inclusive.
    -
    Each element of cityMap will contain the same number of characters.
    -
    Each character of each element of cityMap will be 'B', 'X', or '.'.
    -
    There will be exactly one 'X' character in cityMap.
    -
    walkingDistance will be between 1 and 100, inclusive.
    Examples
    0)

    ????
    {"...B.",
     ".....",
     "..X.B",
     ".....",
     "B...."}
    3
    Returns: 2
    You can reach the bus stop at the top (3 units away), or on the right (2 units
    away). The one in the lower left is 4 units away, which is too far. 1)

    ????
    {"B.B..",
     ".....",
     "B....",
     ".....",
     "....X"}
    8
    Returns: 3
    A distance of 8 can get us anywhere on the map, so we can reach all 3 bus stops.
    2)

    ????
    {"BBBBB",
     "BB.BB",
     "B.X.B",
     "BB.BB",
     "BBBBB"}
    1
    Returns: 0
    Plenty of bus stops, but unfortunately we cannot reach any of them.
    3)

    ????
    {"B..B..",
     ".B...B",
     "..B...",
     "..B.X.",
     "B.B.B.",
     ".B.B.B"}
    3
    Returns: 7

    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-15 13:14 Dion 閱讀(1203) 評論(0)  編輯  收藏 所屬分類: Java
    主站蜘蛛池模板: 亚洲精品GV天堂无码男同| 黄色免费网址大全| 亚洲va在线va天堂va不卡下载| 国产精品视频全国免费观看| 99999久久久久久亚洲| 亚洲变态另类一区二区三区| 国产曰批免费视频播放免费s| 日韩av无码久久精品免费| 毛片免费vip会员在线看| 日本免费在线观看| 日本a级片免费看| 亚洲av日韩综合一区在线观看| 亚洲永久网址在线观看| 麻豆安全免费网址入口| 尤物永久免费AV无码网站| 亚洲国产天堂久久久久久| 亚洲五月综合网色九月色| 色窝窝免费一区二区三区 | 91福利免费视频| 亚洲成av人片一区二区三区| 亚洲最大黄色网站| 国产拍拍拍无码视频免费| 国产伦一区二区三区免费| 亚洲天堂中文字幕在线观看| 一区二区三区免费视频网站 | 成人免费无码大片A毛片抽搐 | www.亚洲日本| 永久黄网站色视频免费观看| 亚洲福利视频导航| 丁香六月婷婷精品免费观看| 国产亚洲成人久久| 曰批全过程免费视频观看免费软件| a级在线免费观看| 免费一级做a爰片性色毛片| 亚洲国产欧洲综合997久久| 免费播放特黄特色毛片| 少妇性饥渴无码A区免费 | 国产亚洲成av片在线观看| 亚洲视频一区在线观看| 中文字幕无码精品亚洲资源网久久| 免费福利在线观看|