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

            欧美激情精品久久久久久| 精品国产乱码久久久久久人妻| 97超级碰碰碰久久久久| 四虎国产精品免费久久久| 一本色道久久88加勒比—综合| 国产精品99久久不卡| 色99久久久久高潮综合影院| 久久人人爽人人爽人人爽| A狠狠久久蜜臀婷色中文网| 久久这里只有精品视频99| 亚洲国产精品18久久久久久| 日本一区精品久久久久影院| 少妇人妻综合久久中文字幕| 久久精品一区二区| 亚洲色欲久久久久综合网| 国产精品国色综合久久| 综合久久一区二区三区| 久久最近最新中文字幕大全| 久久九九兔免费精品6| 久久成人18免费网站| 久久er99热精品一区二区| A级毛片无码久久精品免费| 国产免费久久久久久无码| 中文字幕日本人妻久久久免费| 中文字幕成人精品久久不卡| 午夜精品久久久久久久久| 久久亚洲电影| 国产成人精品久久亚洲高清不卡 | 久久精品一本到99热免费| 无码八A片人妻少妇久久| 久久93精品国产91久久综合| 久久这里只精品国产99热| 无码国内精品久久人妻蜜桃| 久久精品无码一区二区app| 久久久久久免费一区二区三区| 久久天堂AV综合合色蜜桃网| 久久人人爽人人爽人人av东京热 | 69久久精品无码一区二区| 久久综合色老色| 国产成人精品综合久久久久| 一本色道久久HEZYO无码|