BdW44222

8. * Seize the Fire

Jul 2nd, 2021 (edited)
844
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fires_with_cells = [el for el in input().split("#")]
  2. water = int(input())
  3. total_effort = 0
  4. total_fire = 0
  5. valid_cells = []
  6.  
  7. for i in range(len(fires_with_cells)):
  8.     fires_with_cells[i] = str(fires_with_cells[i]).split(" = ")
  9.  
  10. for el in fires_with_cells:
  11.     type_of_fire = str(el[0])
  12.     cell = int(el[1])
  13.     if water < cell:
  14.         if water < 0:
  15.             continue
  16.     if type_of_fire == "High" and 81 <= cell <= 125:
  17.         water -= cell
  18.         total_effort += (cell * 0.25)
  19.         total_fire += cell
  20.         valid_cells.append(cell)
  21.     elif type_of_fire == "Medium" and 51 <= cell <= 80:
  22.         water -= cell
  23.         total_effort += (cell * 0.25)
  24.         total_fire += cell
  25.         valid_cells.append(cell)
  26.     elif type_of_fire == "Low" and 1 <= cell <= 50:
  27.         water -= cell
  28.         total_effort += (cell * 0.25)
  29.         total_fire += cell
  30.         valid_cells.append(cell)
  31.  
  32. print("Cells:")
  33. for cells in valid_cells:
  34.     print(f" - {cells}")
  35.  
  36. print(f"Effort: {total_effort:.2f}")
  37. print(f"Total Fire: {total_fire:.0f}")
  38.  
RAW Paste Data