top button
Flag Notify
Site Registration

Spider and Fly.

+7 votes
143 views

In an empty rectangular room in the sizes АхВхС (the length, width, height) has fallen to the floor the fallen asleep fly. The spider who was on one of walls, or on a room’s floor, has started to move to it on the shortest way.

On what distance it thus will move?

   Input

In the first line it is set the sizes of a room А, В, С. In the second line - co-ordinates of a fly on the floor X1, Y1, and spider X2, Y2, Z2.

All input date - the integers which are not exceeding 500.

   Output

One line – the distance on which the spider will move, calculated to within 2 signs after a decimal point.

posted Nov 18, 2013 by Anuj Yadav

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+3 votes

A list contains a set of numbers, one number presents once and other numbers present even no. of times. Find out the number that occurs once in the list.

+6 votes

Given a matrix with 1s and 0s, please find the number of groups of 1s. A group is defined by horizontally or vertically adjacent 1s.

+6 votes
                    50                      50
                   /  \                    /  \
                  20     30              30   20
Sample Tree<---   /  \                       /  \   ----> Mirror image
               70      80                   80   70
              /  \    \                    /    /  \  
             10  40     60                60   40   10
+7 votes
                    10
                    /  \                    
                   7     15
                  / \    / \
                 6   8  12  18
                /     \
               5       9
            (Given Binary tree) 
...