ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Фёдор Меньшиков. Тренировки > задача:


025- 2013-Nov-01. 50328 - How far away

Гость
• Вопросы к жюри (1)

Задачи сборника

• 004. 50424 - Area
• 004. 50522 - Multiplication Table - 2
• 012. 50352 - Selling Cows
• 017. 50537 - esreveR Triangle
• 018. 50491 - Brokers
• 018. 50787 - Expected Value
• 020. 50485 - Center of gravity of a ...
• 024. 50372 - Number Quadruplets
• 025- 2013-Nov-01. 50328 - How...
• 026. 50487 - Radius of Inscribed Circle
• 027. Albanian Airlines
• 028. 50483 - Group Total
• 033. 50588 - Perpunimi i nje liste n...
• 035. 50573 - Numri dhe shuma
• 044. 50597 - Vizatojme Diamante
• 058. 50574 - Numrat Trekendesh
• 072. 50473 - Counting Circles Positions

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan.

How far away

Question: On a Cartesian coordinate system, your robot is given a series of directions: Up (U), Down (D), Right (R) or Left (L) followed by a positive integer. The robot starts from coordinate (x,y) and travels on the given direction with the given amount of steps. You are asked to find Euclidean distance from the origin (0,0).

Input specification
You are first given the starting coordinates (x,y). Starting from the next line you are given the direction (U, D, R, or L) and the number of steps (nsteps) on the given direction where 1 ≤ nsteps ≤ 100 There are at most 100000 lines in the data series and it ends with a '#' sign.

Output specification
Show a floating point number with 3 decimal place which represent the Euclidean distance from the origin.

Sample Input I
3 2
U 2
D 4
R 2
#
Sample Input II
4 6
D 5
L 7
D 2
R 2
#
Sample Output I
5
Sample Output II
1.414

Для отправки решений необходимо выполнить вход.

www.contester.ru