Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. # -*-coding: utf-8 -*-
  2. x = 0
  3. y = 0
  4. n = 0
  5. tr = True
  6.  
  7. clad_x = int(input())
  8. clad_y = int(input())
  9. storona = input()
  10. kol = int(input())
  11.  
  12. while storona != 'стоп':
  13. if clad_x == x and clad_y == y:
  14. tr = False
  15.  
  16. if storona == 'север':
  17. y += kol
  18. if tr:
  19. n += 1
  20.  
  21. elif storona == 'запад':
  22. x -= kol
  23. if tr:
  24. n += 1
  25.  
  26. elif storona == 'юг':
  27. y -= kol
  28. if tr:
  29. n += 1
  30.  
  31. elif storona == 'восток':
  32. x += kol
  33. if tr:
  34. n += 1
  35.  
  36. storona = input()
  37. if storona != 'стоп':
  38. kol = int(input())
  39.  
  40. print(n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement