| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
shu problem HWalk Time Limit : 1 seconds Memory Limit : 10MB One day, Tracy felt tired after a whole day’s programming. She decided to leave from computer and have a walk. The room is a rectangle. Tracy started from computer, choosing an angle as she like, then start walking. Tracy would walk straight forever. If Tracy collides with a wall, she would be rebounded off it. The collision reduces no energy, and if we consider the route as light, the incident angle of the light is equal to the reflection angle. Tracy will keep walking until inspiration comes. The speed is constant. But, mum wanted to know the walking time so that she could remind Tracy go back to work. Tracy wants to test mum, so she recorded the sequence of collision and told them to mum. Can you help mum to work out the total length of Tracy’s route? Input: The input file contains several test cases. For each test case: The first line contains two numbers w, l (0<=w,l<=1000), the width and length of the room, respectively. The second line contains two numbers x0, y0, representing the position of the computer is (x0, y0). The third line contains two numbers x1, y1, representing the position of the inspiration is (x1, y1). The last line is a string. Each character is one of ’F’,’B’,’L’,’R’, means the wall is in front, back, left or right. The length of the string will be less or equal than 1000. All the coordinates are real numbers. Output: one real number, the total length of the route. The result should be accurate up to 4 decimals. Sample Input: 10 20 9 1 1 19 FLRLRB Sample Output: 52.8015 The picture below shows the sample: Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator