当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5418:Victor and World

题目描述
After trying hard for many years, Victor has finally received a pilot license. To have a celebration, he intends to buy himself an airplane and fly around the world. There are $n$ countries on the earth, which are numbered from $1$ to $n$. They are connected by $m$ undirected flights, detailedly the $i$-th flight connects the $u_i$-th and the $v_i$-th country, and it will cost Victor's airplane $w_i$ L fuel if Victor flies through it. And it is possible for him to fly to every country from the first country.

Victor now is at the country whose number is $1$, he wants to know the minimal amount of fuel for him to visit every country at least once and finally return to the first country.
输入解释
The first line of the input contains an integer $T$, denoting the number of test cases.
In every test case, there are two integers $n$ and $m$ in the first line, denoting the number of the countries and the number of the flights.

Then there are $m$ lines, each line contains three integers $u_i$, $v_i$ and $w_i$, describing a flight.

$1\leq T\leq 20$.

$1\leq n\leq 16$.

$1\leq m\leq 100000$.

$1\leq w_i\leq 100$.

$1\leq u_i, v_i \leq n$.
输出解释
Your program should print $T$ lines : the $i$-th of these should contain a single integer, denoting the minimal amount of fuel for Victor to finish the travel.
输入样例
1
3 2
1 2 2
1 3 3
输出样例
10
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5418

最后修改于 2020-10-25T23:22:30+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 262144/131072K(Java/Others)