Advertisement
PlotnikovPhilipp

Untitled

Oct 17th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import math
  3. w, d = [int(i) for i in input().split()]
  4. x0, y0 = [int(i) for i in input().split()]
  5. x1, y1 = [int(i) for i in input().split()]
  6. string = input()
  7. L = string.count('L')
  8. R = string.count('R')
  9. F = string.count('F')
  10. B = string.count('B')
  11.  
  12. """
  13.  
  14.    По оси oX
  15.  
  16. """
  17. width = 0
  18. kx = L + R - 1
  19. if kx < 0:
  20.     kx = 0
  21. if L == 0 and R == 0:
  22.     width = x0 - x1
  23. elif string.find('L') < string.find('R'):
  24.     if L > R:
  25.         width = x0 + x1 + w*kxky
  26.     elif L == R:
  27.         width = x0 + (w - x1) + w*kx
  28. elif string.find('R') < string.find('L'):
  29.     if R > L:
  30.         width = (w - x0) + (w - x1) + w*kx
  31.     elif R == L:
  32.         width = (w - x0) + x1 + w*kx
  33.  
  34.  
  35. """
  36.  
  37.    По оси oY
  38.  
  39. """
  40. height = 0
  41. ky = F + B - 1
  42. if ky < 0:
  43.     ky = 0
  44. if F == 0 and B == 0:
  45.     height = y0 - y1
  46. elif string.find('F') < string.find('B'):
  47.     if F > B:
  48.         height = y0 + y1 + d*ky
  49.     elif F == B:
  50.         height = y0 + (d - y1) + d*ky
  51. elif string.find('B') < string.find('F'):
  52.     if B > F:
  53.         height = (d - y0) + (d - y1) + d*ky
  54.     elif B == F:
  55.         height = (d - y0) + y1 + d*ky
  56. result = math.sqrt(height**2 + width**2)
  57. print(width, height)
  58. print(round(result, 4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement