• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 74,  comments - 33,  trackbacks - 0
            Perfect Service
            Time Limit: 2000MS Memory Limit: 65536K
            Total Submissions: 661 Accepted: 319

            Description

            A network is composed of N computers connected by N ? 1 communication links such that any two computers can be communicated via a unique route. Two computers are said to be adjacent if there is a communication link between them. The neighbors of a computer is the set of computers which are adjacent to it. In order to quickly access and retrieve large amounts of information, we need to select some computers acting as servers to provide resources to their neighbors. Note that a server can serve all its neighbors. A set of servers in the network forms a perfect service if every client (non-server) is served by exactly one server. The problem is to find a minimum number of servers which forms a perfect service, and we call this number perfect service number.

            We assume that N (≤ 10000) is a positive integer and these N computers are numbered from 1 to N. For example, Figure 1 illustrates a network comprised of six computers, where black nodes represent servers and white nodes represent clients. In Figure 1(a), servers 3 and 5 do not form a perfect service because client 4 is adjacent to both servers 3 and 5 and thus it is served by two servers which contradicts the assumption. Conversely, servers 3 and 4 form a perfect service as shown in Figure 1(b). This set also has the minimum cardinality. Therefore, the perfect service number of this example equals two.

            Your task is to write a program to compute the perfect service number.

            Input

            The input consists of a number of test cases. The format of each test case is as follows: The first line contains one positive integer, N, which represents the number of computers in the network. The next N ? 1 lines contain all of the communication links and one line for each link. Each line is represented by two positive integers separated by a single space. Finally, a 0 at the (N + 1)th line indicates the end of the first test case.

            The next test case starts after the previous ending symbol 0. A ?1 indicates the end of the whole inputs.

            Output

            The output contains one line for each test case. Each line contains a positive integer, which is
            the perfect service number.

            Sample Input

            6
            1 3
            2 3
            3 4
            4 5
            4 6
            0
            2
            1 2
            -1

            Sample Output

            2
            1
            樹的最小支配集:和3659一樣。TreeDP求解:
            代碼同上篇隨筆一樣:
            posted on 2009-04-09 22:58 KNIGHT 閱讀(116) 評論(0)  編輯 收藏 引用
            <2009年4月>
            2930311234
            567891011
            12131415161718
            19202122232425
            262728293012
            3456789

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            午夜不卡888久久| 日韩av无码久久精品免费| 国产香蕉97碰碰久久人人| 99热成人精品免费久久| 久久www免费人成精品香蕉| 亚洲人AV永久一区二区三区久久| 亚洲αv久久久噜噜噜噜噜| 伊人久久综在合线亚洲2019| 久久伊人精品青青草原日本| 亚洲va久久久噜噜噜久久男同 | 亚洲国产视频久久| 久久精品一区二区国产| 久久久久亚洲AV无码专区网站 | …久久精品99久久香蕉国产 | 人妻无码αv中文字幕久久| 狠狠狠色丁香婷婷综合久久五月| 亚洲午夜久久久久久噜噜噜| 久久免费精品一区二区| 伊人色综合久久天天人手人婷 | 性欧美丰满熟妇XXXX性久久久| 欧美久久一级内射wwwwww.| A狠狠久久蜜臀婷色中文网| 久久国产AVJUST麻豆| 51久久夜色精品国产| 久久综合综合久久97色| 亚洲中文字幕无码久久2020| 久久久久久久综合狠狠综合| 亚洲国产成人久久精品99 | 亚洲色大成网站www久久九| 国产精品久久久久a影院| 国产真实乱对白精彩久久| 99精品久久久久久久婷婷| 久久久久人妻一区精品性色av| 囯产精品久久久久久久久蜜桃 | 亚洲午夜无码久久久久| 色婷婷久久综合中文久久一本| 色综合久久最新中文字幕| 国产精品久久久福利| 久久精品国产精品亚洲毛片| 无码专区久久综合久中文字幕 | 国产精品18久久久久久vr |