• <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>

            Farm Tour poj 2135 最小費用流

            Posted on 2012-05-01 16:37 lenohoo 閱讀(97) 評論(0)  編輯 收藏 引用
            Farm Tour

            Description

            When FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 <= N <= 1000) fields numbered 1..N, the first of which contains his house and the Nth of which contains the big barn. A total M (1 <= M <= 10000) paths that connect the fields in various ways. Each path connects two different fields and has a nonzero length smaller than 35,000.

            To show off his farm in the best way, he walks a tour that starts at his house, potentially travels through some fields, and ends at the barn. Later, he returns (potentially through some fields) back to his house again.

            He wants his tour to be as short as possible, however he doesn't want to walk on any given path more than once. Calculate the shortest tour possible. FJ is sure that some tour exists for any given farm.

            Input

            * Line 1: Two space-separated integers: N and M.

            * Lines 2..M+1: Three space-separated integers that define a path: The starting field, the end field, and the path's length.

            Output

            A single line containing the length of the shortest tour.

            Sample Input

            4 5
            1 2 1
            2 3 1
            3 4 1
            1 3 2
            2 4 2

            Sample Output

            6 

            Source


            MCF

            posts - 3, comments - 1, trackbacks - 0, articles - 16

            Copyright © lenohoo

            国产香蕉久久精品综合网| 欧美午夜精品久久久久免费视| 91久久成人免费| 无码人妻少妇久久中文字幕| 日韩人妻无码一区二区三区久久| 精品久久777| 国产精品久久久久久久久久影院| 久久精品www| 久久久噜噜噜久久中文福利| 久久精品免费网站网| 91精品国产色综合久久| 国产精品成人久久久| 国产精品久久久久一区二区三区| 人妻少妇久久中文字幕| 无码人妻少妇久久中文字幕 | 久久人爽人人爽人人片AV| 久久亚洲色一区二区三区| 狠狠色噜噜狠狠狠狠狠色综合久久| 久久精品人人做人人爽电影| 久久男人中文字幕资源站| 99久久精品免费看国产一区二区三区| 亚洲va久久久噜噜噜久久天堂| 亚洲天堂久久久| 亚洲国产香蕉人人爽成AV片久久 | 日韩亚洲欧美久久久www综合网| 97久久久久人妻精品专区| 久久国产精品77777| 久久伊人五月丁香狠狠色| 武侠古典久久婷婷狼人伊人| 久久免费99精品国产自在现线| 精品欧美一区二区三区久久久| 精品国产乱码久久久久久浪潮 | 欧美亚洲另类久久综合婷婷 | 久久精品国产亚洲AV麻豆网站 | 国产精品视频久久| 国产一区二区三区久久精品| 四虎国产精品免费久久5151| 国产精品欧美久久久久无广告| 久久人人爽人人爽人人片AV东京热| 免费一级做a爰片久久毛片潮| 少妇熟女久久综合网色欲|