F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Tears of lonely star

Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 123    Accepted Submission(s): 11


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
 

Author
WhereIsHeroFrom
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-04 10:51:14, Gzip enabled