• <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 閱讀(91) 評論(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

            久久综合色之久久综合| 精品久久久久久久久久久久久久久| 日本精品久久久久影院日本 | 香蕉久久夜色精品国产尤物| 亚洲欧洲久久久精品| 久久ZYZ资源站无码中文动漫| 91精品国产91久久久久久蜜臀| 久久久久亚洲?V成人无码| 久久久久波多野结衣高潮| 久久99精品久久久久久| 亚洲国产成人久久精品99 | 婷婷综合久久中文字幕| 一本大道久久东京热无码AV| 久久99精品国产自在现线小黄鸭| 精品水蜜桃久久久久久久| 亚洲AV日韩精品久久久久久| 精品久久久久久无码中文野结衣| 亚洲狠狠婷婷综合久久蜜芽| 久久久久99精品成人片| 狠狠久久亚洲欧美专区| 一本色道久久HEZYO无码| 久久亚洲中文字幕精品一区| 狠色狠色狠狠色综合久久| 久久成人小视频| 无码精品久久一区二区三区| 青青青青久久精品国产| 久久久噜噜噜久久熟女AA片| 国内高清久久久久久| 久久免费视频1| 狠狠色丁香婷婷久久综合 | 久久久久精品国产亚洲AV无码| 久久久无码精品午夜| 国产日产久久高清欧美一区| 久久久噜噜噜www成人网| 久久综合亚洲欧美成人| 亚洲va久久久噜噜噜久久 | 国产亚洲美女精品久久久久狼| 97精品依人久久久大香线蕉97| 精品多毛少妇人妻AV免费久久| 久久久这里只有精品加勒比| 伊人久久大香线蕉AV一区二区|