Advertisement
Guest User

Rzutka gra 2

a guest
Dec 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. def rzutka():
  2.     range = input().split(" ")
  3.     x = int(range[0])
  4.     y = int(range[1])
  5.     throwsNumber = int(input())
  6.     throws = input().split(" ")
  7.     points = 0
  8.     i = 0
  9.     while i < throwsNumber:
  10.         throw = int(throws[i])
  11.         if throw >= x and throw <=y:
  12.             points = 0
  13.         elif throw < x:
  14.             points += x - throw
  15.         elif throw > y:
  16.             points += throw - y
  17.         i += 1
  18.     print(points)
  19.  
  20. rzutka()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement