编程介的小学生 2017-12-07 16:06 采纳率: 20.5%
浏览 905
已采纳

Tears of lonely star

Problem Description
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).

Input
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.

Output
For each test case, write a single line with a positive integer indicating the square of the shortest path length.

Sample Input
1 1 2 1 1 2
1 1 1 1 1 1
0 0 0 0 0 0

Sample Output
8
5

  • 写回答

1条回答 默认 最新

  • threenewbee 2018-02-18 15:28
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 链接问题 C++LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接