#P2358. 蚂蚁搬家
蚂蚁搬家
Description
Consider a cube with edge length . An ant starts from a point on the top face and crawls to a point on the bottom face. The ant can only move along the surface of the cube. Write a program to compute a shortest distance from the start to the end along the surface.
The coordinates of the start and end points are read from the keyboard. The coordinate origins on both the top and bottom faces are at the centers of their squares, and the -axis and -axis directions of the two face coordinate systems are aligned. Output the answer rounded to three decimal places.
Input Format
real numbers (each in ), representing the coordinates of the starting point and the destination point.
Output Format
The shortest distance.
0.26 0.50 0.50 0.18
1.146
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号