Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- balls = [0]*501
- user = {}
- countUser = 0
- for _ in range(n):
- query = input().split()
- if query[0] == 'ACHIEVE':
- try:
- user[int(query[1])] += 0
- balls[user[int(query[1])]] -= 1
- except:
- countUser += 1
- user[int(query[1])] = int(query[2])
- balls[int(query[2])] += 1
- elif query[0] == 'RATING':
- try:
- print("%.6f" % ((sum(balls[:user[int(query[1])]]))/(countUser-1)))
- except:
- try:
- balls[user[int(query[1])]] += 0
- print('1.000000')
- except:
- print('0.000000')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement