Minggu, 08 Januari 2017

UVA 10773 - Back to Intermediate Math Solution

Problem Statement: Back to Intermediate Math

Explanation

The fastest way to cross the river just aim to reach another end of the river without calculating the stream of the river. Otherwise, the shortest way is a straight line that perpendicular with the riverside. Both fastest way and shortest way can be calculated as follow.

  • Fastest Way = d / u
  • Shortest Way = d / Math.sqrt(u^2 - v^2)
Print "Can't Determine" whenever you get an unreal result (u = 0 or u < v). Also, you cannot determine the difference if v = 0.

Source Code

Tidak ada komentar:

Posting Komentar