lovelog - and D, in that order. 0 < B,C,D...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Love Log ---- --- Olivia, the arrow beetle, is on the ground near a log. On the other side of the log is Oliver, the love of her life. She wants to get to him. How far must she travel? Olivia and Oliver are on the ground, the log rests on the ground, and Olivia must fly over the top of the log to get to Oliver. You can assume that the ground is perfectly flat and the log is a perfect cylinder with axis perpendicular to the line between Olivia and Oliver. The distance B from Olivia to the point where the log touches the ground, the distance C from this point to Oliver, and the diameter D of the log are given. Arrow beetles fly in perfectly straight lines when they need to get to a point they can see, and otherwise can fly right next to a curved surface. You can assume `right next to' means infinitesimally close to. Olivia or Oliver can be in the shadow of the log i.e., B < D/2 or C < D/2 are possible. Input ----- Several test cases, each with one line containing B, C,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and D, in that order. 0 &lt; B,C,D &lt; 1000000. Input ends with a line containing three zeros. You should use double precision floating point arithme-tic to do input and computation, as input with 3 decimal places can have up to 9 significant digits. p Output------For each test case, one line containing the length of the shortest arrow beetle flying route from Olivia to Oliver. This length must have exactly 3 decimal places. Sample Input------ -----10.0 10.0 20.0 0.1 0.1 20.0 10.0 80.0 20.0 Sheet1 Page 2 0 0 0 Sample Output------ ------51.42 62.63 108.2 File: lovelog.txt Author: Bob Walton &lt;; Date: Sun Oct 20 22:44:48 EDT 2002 The authors have placed this file in the public domain they make no warranty and accept no liability for this file. RCS Info (may not be true date or author): $Author: walton $ $Date: 2002/10/21 02:46:01 $ $RCSfile: lovelog.txt,v $ $Revision: 1.3 $...
View Full Document

This note was uploaded on 04/29/2011 for the course IT 201 taught by Professor K.v.arya during the Spring '11 term at IIT Kanpur.

Page1 / 2

lovelog - and D, in that order. 0 &amp;amp;lt; B,C,D...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online