GeorgiLukanov87

seize da fire

Jun 5th, 2022 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. HIGH_RANGE = range(81, 126)
  2. MID_RANGE = range(51, 81)
  3. LOW_RANGE = range(1, 51)
  4. fire_data = input().split('#')
  5. total_water = int(input())
  6. fire_cells = []
  7. for every_fire in fire_data:
  8.     fire_range, fire_value = every_fire.split(' = ')
  9.     fire_value = int(fire_value)
  10.     if fire_value > total_water:
  11.         continue
  12.     if fire_range == 'High' and fire_value not in HIGH_RANGE:
  13.         continue
  14.     elif fire_range == 'Medium' and fire_value not in MID_RANGE:
  15.         continue
  16.     elif fire_range == 'Low' and fire_value not in LOW_RANGE:
  17.         continue
  18.     total_water -= fire_value
  19.     fire_cells.append(fire_value)
  20. print("Cells:")
  21. for cell in fire_cells:
  22.     print(f" - {cell}")
  23. effort = sum(fire_cells) * 0.25
  24. print(f'Effort: {effort:.2f}')
  25. total_fire = sum(fire_cells)
  26. print(f"Total Fire: {total_fire}")
Add Comment
Please, Sign In to add comment