Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'Damjan'
- import math
- def A1(s):
- if s>=60:
- return 1.0
- elif s<60:
- return 1.0/pow(math.e,(60-math.fabs(s)))
- else:
- return -1.0
- def A2(s):
- if s<=10:
- return 1.0
- elif s>10:
- return 1.0/(1+pow(math.e,math.fabs(10-s)))
- else:
- return -1.0
- def B1(s):
- if s>=0.8:
- return 1.0
- elif s<0.8:
- return 1.0/(1+pow(0.2+s,3))
- else:
- return -1/0
- def B2(s):
- if s<=0.1:
- return 1.0
- elif s>0.1:
- return 1/(1+pow(0.9+s,2))
- else:
- return -1.0
- 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(w1,w2,w3,c1,c2,c3):
- return (w1*c1+w2*c2+w3+c3)/(w1+w2+w3)
- def C1():
- return 2000.0
- def C2():
- return 500.0
- def C3():
- return 100.0
- if __name__ == "__main__":
- t=input()
- h=input()
- v1=Rule1_min(t,h)
- v2=Rule2_min(t,h)
- v3=Rule3_min(t,h)
- b1=C1()
- b2=C2()
- b3=C3()
- print COG(v1,v2,v3,b1,b2,b3)
Advertisement
Add Comment
Please, Sign In to add comment