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

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

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

    emu in blogjava

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      171 隨筆 :: 103 文章 :: 1052 評論 :: 2 Trackbacks
    DiskClusters
    Problem Statement

    You are given a String disk representing the clusters on a disk. An 'X' represents a used cluster,
    and a '.' represents an available cluster. You are also given an int size representing the size, 
    in clusters, of a file waiting to be written to disk. A file can only be stored in clusters not already being used.
    Return the minimum number of groups of consecutive clusters needed to store the file on the disk.
    (The disk does not wrap around at the end.) Return -1 if the disk does not have enough space available
    to store the file.
    Definition

    Class:
    DiskClusters
    Method:
    minimumFragmentation
    Parameters:
    String, int
    Returns:
    int
    Method signature:
    int minimumFragmentation(String disk, int size)
    (be sure your method is public)


    Constraints
    -
    disk will contain between 1 and 50 characters, inclusive.
    -
    Each character of disk will be 'X' or '.'.
    -
    size will be between 1 and 50, inclusive.
    Examples
    0)


    "."
    2
    Returns: -1
    We can't fit the file on the disk.
    1)


    ".XXXXXXXX.XXXXXX.XX.X.X."
    6
    Returns: 6
    There is only ever one cluster together, so all six clusters are separated.
    2)


    "XX..XX....X.XX........X...X.XX...XXXX..XX...XXXXX."
    12
    Returns: 2
    We fit eight clusters together, and four clusters together.
    3)


    ".X.XXXX.......XX....X.....X............XX.X.....X."
    20
    Returns: 3

    4)


    "....X...X..X"
    11
    Returns: -1

    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-13 13:33 emu 閱讀(942) 評論(0)  編輯  收藏 所屬分類: google編程大賽模擬題及入圍賽真題
    主站蜘蛛池模板: 国产偷国产偷亚洲高清人| 免费黄色一级毛片| 一级黄色片免费观看| 亚洲H在线播放在线观看H| 亚洲精品高清国产一线久久| 免费人妻无码不卡中文字幕18禁| 91精品成人免费国产片| 人人玩人人添人人澡免费| 一区二区视频免费观看| 国产综合激情在线亚洲第一页| 国产成人精品亚洲日本在线| 亚洲狠狠综合久久| 国产成人精品日本亚洲网站| 久久精品亚洲福利| 亚洲国产成人久久笫一页| 免费在线观看日韩| 国产一区二区三区免费在线观看| 黄瓜视频高清在线看免费下载| 亚洲免费在线视频观看| 1000部啪啪毛片免费看| **一级毛片免费完整视| 小草在线看片免费人成视久网| 青柠影视在线观看免费| 在线免费观看伊人三级电影| 亚洲国产免费综合| aa午夜免费剧场| 中文字幕av免费专区| 中文在线免费看视频| 你是我的城池营垒免费观看完整版| 一个人免费观看www视频| caoporn国产精品免费| 国产精品午夜免费观看网站| 一级特级aaaa毛片免费观看| 一本一道dvd在线观看免费视频 | 日本在线高清免费爱做网站| 99精品视频在线视频免费观看| 91大神在线免费观看| 无码区日韩特区永久免费系列 | 老司机亚洲精品影视www| 国产精品亚洲玖玖玖在线观看| 亚洲性日韩精品一区二区三区 |