2014
02-12

# Tears of lonely star

Tears of lonely star——I was a drop of tear from the lonely star which hidden in you body million years before. All your feelings were seen by me, let me warm your face !
Today, we assume a lonely star is a cuboid of integral dimensions lx × ly × lz . The edges of the star are axis-aligned, and one corner of the star is located at position (0, 0, 0). Given the coordinates (x, y, z) of some arbitrary position on the surface of the lonely star, your goal is to return the square of the length of the shortest path along the star’s surface from (0, 0, 0) to (x, y, z).

The input test file will contain multiple test cases, each of which consists of six integers lx, ly , lz , x, y, z where 1 ≤lx, ly , lz ≤ 1000. Note that the star may have zero volume, but the point (x, y, z) is always guaranteed to be on one of the six sides of the star. The end-of-file is marked by a test case with lx=ly= lz = x = y = z = 0 and should not be processed.

The input test file will contain multiple test cases, each of which consists of six integers lx, ly , lz , x, y, z where 1 ≤lx, ly , lz ≤ 1000. Note that the star may have zero volume, but the point (x, y, z) is always guaranteed to be on one of the six sides of the star. The end-of-file is marked by a test case with lx=ly= lz = x = y = z = 0 and should not be processed.

1 1 2 1 1 2
1 1 1 1 1 1
0 0 0 0 0 0

8
5

1. 我还有个问题想请教一下，就是感觉对于新手来说，递归理解起来有些困难，不知有没有什么好的方法或者什么好的建议？

2. 第二块代码if(it != mp.end())应改为if(it != mp.end() && (i+1)!=(it->second +1))；因为第二种解法如果数组有重复元素 就不正确

3. 我没看懂题目
2
5 6 -1 5 4 -7
7 0 6 -1 1 -6 7 -5
我觉得第一个应该是5 6 -1 5 4 输出是19 5 4
第二个是7 0 6 -1 1 -6 7输出是14 7 7
不知道题目例子是怎么得出来的