Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import math
- w, d = [int(i) for i in input().split()]
- x0, y0 = [int(i) for i in input().split()]
- x1, y1 = [int(i) for i in input().split()]
- string = input()
- L = string.count('L')
- print(L)
- R = string.count('R')
- F = string.count('F')
- B = string.count('B')
- """
- По оси oX
- """
- width = 0
- kx = L + R - 1
- if kx < 0:
- kx = 0
- if L == 0 and R == 0:
- width = x0 - x1
- elif L > R:
- width = x0 + x1 + w*kxky
- elif L == R:
- if string.find('L') < string.find('R'):
- width = x0 + (w - x1) + w*kx
- elif string.find('R') < string.find('L'):
- width = (w - x0) + x1 + w*kx
- elif R > L:
- width = (w - x0) + (w - x1) + w*kx
- """
- По оси oY
- """
- height = 0
- ky = F + B - 1
- if ky < 0:
- ky = 0
- if F == 0 and B == 0:
- height = y0 - y1
- if F > B:
- height = y0 + y1 + d*ky
- elif F == B:
- if string.find('F') < string.find('B'):
- height = y0 + (d - y1) + d*ky
- elif string.find('B') < string.find('F'):
- height = (d - y0) + y1 + d*ky
- elif B > F:
- height = (d - y0) + (d - y1) + d*ky
- result = math.sqrt(height**2 + width**2)
- print(round(result, 4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement