ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Championship 2004

About     Problems     Submit solution     Judge status     Standings
Contest is over

C. Cucaracha

Time limit: 1.0 second
Memory limit: 64 MB
Once upon a time a cockroach Vasya running along the kitchen noticed a wonderful crumb. Vasya’s internal voice whispered him that he should reach the crumb using minimum of his vital energy. It meant that he should make the minimal number of his cockroach steps. And even Vasya’s little brain understood that he was to count the motion path neatly.


The first line contains four numbers X, Y, A, R — the cockroach’s initial coordinates, the initial angle between the axis Ox and his motion path and the minimal turning radius of the cockroach (have you thought that cockroaches can turn around at one point?). The second line consists of two numbers KX and KY — the desired crumb coordinates.
Cockroaches count coordinates off the kitchen center and measure in cockroach steps. Inasmuch as a cockroach has six legs, this measure is rather relative, so you aren’t to think that a cockroach can run only integer number of steps. For example, 314.15 steps is the length of Vasya’s night walk.
The absolute values of all the coordinates X, Y, KX, KY and the radius R do not exceed 10000. The angle is counted off the axis Ox counter-clockwise. It’s measured in degrees (cockroaches don’t know radians) and lies in the diapason from 0 to 360.


You are to find the length of the shortest Vasya’s motion path towards the crumb. The result is to be outputted within 4 digits after a decimal point.


1 2 90 10
21 2
Problem Author: Pavel Egorov
Problem Source: USU Championship 2004
To submit the solution for this problem go to the Problem set: 1340. Cucaracha