Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def A1(s):
- # print math.e
- if s >= 60: return 1.0
- return 1 / (math.pow(math.e, 60 - abs(s)))
- def A2(s):
- if s <= 10: return 1.0
- return 1 / (1 + math.pow(math.e, abs(10 - s)))
- def B1(s):
- if s >= 0.8: return 1.0
- return 1 / (1 + math.pow(0.2 + s, 3))
- def B2(s):
- if 0 <= s <= 0.1: return 1.0
- return 1 / (1 + math.pow(0.9 + s, 2))
- def C1(s):
- return 2000
- def C2(s):
- return 500
- def C3(s):
- return 100
- def Rule1_min(s, e):
- return min(A2(s), B2(e))
- def Rule2_min(s, e):
- return min(A1(s), B2(e))
- def Rule3_min(s, e):
- return min(A1(s), B1(e))
- def COG(w, c):
- if len(w) != len(c):
- return -1
- else:
- broitel = 0
- imenitel = 0
- for i in range(len(w)):
- broitel += w[i] * c[i]
- imenitel += w[i]
- return broitel / imenitel
- if __name__ == "__main__":
- t = input()
- h = input()
- w = [Rule1_min(t, h), Rule2_min(t, h), Rule3_min(t, h)]
- c = [C1(t), C2(t), C3(t)]
- cog = COG(w, c)
- print cog
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement