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

            国产成人AV综合久久| 99国内精品久久久久久久| 久久久久亚洲AV无码永不| 久久经典免费视频| 伊色综合久久之综合久久| 一级做a爱片久久毛片| 四虎国产精品免费久久5151| 91精品国产91久久久久久蜜臀| 国产69精品久久久久777| 久久国产精品-久久精品| 丁香五月综合久久激情| 青青久久精品国产免费看| 伊人色综合久久天天网| 亚洲AV无码一区东京热久久| 久久人人爽爽爽人久久久| 99久久国产综合精品麻豆| 久久99毛片免费观看不卡| 国产精品嫩草影院久久| 国产一区二区久久久| 色婷婷综合久久久中文字幕| 国内精品久久国产大陆| 久久久黄片| 亚洲成色WWW久久网站| 亚洲国产精品久久久久久| 午夜精品久久久内射近拍高清| 伊人久久大香线蕉av不卡| 婷婷久久综合九色综合98| 久久免费大片| 国产精品欧美久久久天天影视| 久久国产精品无码网站| 久久婷婷激情综合色综合俺也去| 亚洲国产精品一区二区久久| 久久久久久久精品妇女99| 91精品国产综合久久四虎久久无码一级| 欧美日韩中文字幕久久久不卡| 久久久久成人精品无码中文字幕| 国产亚州精品女人久久久久久 | 久久免费国产精品一区二区| 久久国产乱子伦精品免费午夜| 欧洲人妻丰满av无码久久不卡| 一本色道久久88综合日韩精品|