Advertisement
Nickpips

Untitled

Mar 21st, 2016 (edited)
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.77 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. '''
  4. 1000000 trees per day
  5. 3% in day 3 to 33% in day 70
  6. none during winter
  7. autumn lasts for 20 days 1-20
  8. winter lasts for 16 days 21-36
  9. spring lasts for 20 days 37-56
  10. summer lasts for 16 days 57-72
  11. winter = (day%72)>=21&&(day%72)<=36
  12. '''
  13.  
  14. def isWinter(d):
  15.     d = ((d-1)%72)+1
  16.     return (d>=21) and (d<=36)
  17.  
  18. day = 3
  19. poisoned = 0
  20. cut = 2000000
  21. perc = 0.03
  22. maxp = 33224202171613280406600885863289624718
  23. yearlycut = 0
  24. yearlypoison = 0
  25.  
  26. while True:
  27.    
  28.     if day <= 70:
  29.         perc = 0.03+(0.33-0.03)/(70-3)*(day-3)
  30.     else:
  31.         perc = 0.33
  32.    
  33.     cut += 1000000
  34.    
  35.     if not isWinter(day):
  36.         if poisoned + int(1000000 * perc) > maxp:
  37.             #print cut
  38.             #print poisoned
  39.             dif = (maxp - poisoned) + 1
  40.             cut += (dif * 100) // 33
  41.             poisoned += int(((dif * 100) // 33) * 0.33)
  42.             cut += 1
  43.             #print dif
  44.             break
  45.            
  46.         if day <= 72:
  47.             poisoned += 1000000 * perc
  48.         else:
  49.             poisoned += int(1000000 * perc)
  50.    
  51.     if day == 72:
  52.         poisoned = int(poisoned)
  53.    
  54.     if day >= 73 and day <= 144:
  55.         yearlycut += 1000000
  56.         if not isWinter(day):
  57.             yearlypoison += int(1000000 * perc)
  58.    
  59.     if day == 145:
  60.         #print yearlycut
  61.         #print yearlypoison
  62.         poisoned = int(poisoned)
  63.         years = int((maxp-poisoned) // yearlypoison)
  64.         poisoned += int(yearlypoison * years)
  65.         cut += int(yearlycut * years)
  66.         day += int(72 * years)
  67.        
  68.     if poisoned >= maxp:
  69.         break
  70.    
  71.     day = day + 1
  72.  
  73.  
  74. #print poisoned
  75. #print cut
  76. #print hex(cut)[2:-1]
  77. print hex(cut)[2:-1].decode("hex")
  78.  
  79. '''l a s a c t f { a b 0 u 7 _ 7 r 3 3 _ f 1 f 7 y }'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement