UVA10944 Nuts for nuts..

Background

[PDF](https://uva.onlinejudge.org/external/109/p10944.pdf)

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=21&page=show_problem&problem=1885 So as Ryan and Larry decided that they don't really taste so good, they realized that there are some nuts located in certain places of the island.. and they love them! Since they're lazy, but greedy, they want to know the shortest tour that they canuse togather every single nut! Can you help them? ![](https://cdn.luogu.com.cn/upload/image_hosting/68kj5kfv.png)

Input Format

You'll be given $x$, and $y$, both less than $20$, followed by $x$ lines of $y$ characters each as a map of the area, consisting sorely of `.`, `#`, and `L`. Larry and Ryan are currently locatedin `L`, and the nuts are represented by `#`. **They can travel in all $8$ adjacent direction in one step.** See below for an example. There will be at most $15$ places where there are nuts, and `L` will only appear once.

Output Format

On each line, output the minimum amount of steps starting from `L`, gather all the nuts, and back to `L`.

Explanation/Hint

**Note:** In the sample below, Larry and Ryan will go south for anut, then south again for another nut, then south twice for another nut, and then back where they are.