DamSi

Untitled

Oct 23rd, 2015
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. __author__ = 'Damjan'
  2. import math
  3.  
  4. def A1(s):
  5.     if s>=60:
  6.         return 1.0
  7.     elif s<60:
  8.         return 1.0/pow(math.e,(60-math.fabs(s)))
  9.     else:
  10.         return -1.0
  11.  
  12. def A2(s):
  13.     if s<=10:
  14.         return 1.0
  15.     elif s>10:
  16.         return 1.0/(1+pow(math.e,math.fabs(10-s)))
  17.     else:
  18.         return -1.0
  19.  
  20. def B1(s):
  21.     if s>=0.8:
  22.         return 1.0
  23.     elif s<0.8:
  24.         return 1.0/(1+pow(0.2+s,3))
  25.     else:
  26.         return -1/0
  27.  
  28. def B2(s):
  29.     if s<=0.1:
  30.         return 1.0
  31.     elif s>0.1:
  32.         return 1/(1+pow(0.9+s,2))
  33.     else:
  34.         return -1.0
  35.  
  36. def Rule1_min(s,e):
  37.     return min(A2(s),B2(e))
  38.  
  39. def Rule2_min(s,e):
  40.     return min(A1(s),B2(e))
  41.  
  42. def Rule3_min(s,e):
  43.     return min(A1(s),B1(e))
  44.  
  45. def COG(w1,w2,w3,c1,c2,c3):
  46.     return (w1*c1+w2*c2+w3+c3)/(w1+w2+w3)
  47. def C1():
  48.     return 2000.0
  49. def C2():
  50.     return 500.0
  51. def C3():
  52.     return 100.0
  53.  
  54. if __name__ == "__main__":
  55.     t=input()
  56.     h=input()
  57.     v1=Rule1_min(t,h)
  58.     v2=Rule2_min(t,h)
  59.     v3=Rule3_min(t,h)
  60.     b1=C1()
  61.     b2=C2()
  62.     b3=C3()
  63.     print COG(v1,v2,v3,b1,b2,b3)
Advertisement
Add Comment
Please, Sign In to add comment