Humidifier 1

ABC 383

Problem 33 of 50

Easy

What to do

You have a humidifier that starts empty, and you will add water to it several times at different times. Each time you add water, some water will evaporate over time, and you need to find out how much water is left in the humidifier after the last addition.

Key Concepts

variables loops basic math input/output

Examples

Input: 4, [(1, 3), (3, 1), (4, 4), (7, 1)]

Output: 3

Input: 3, [(1, 8), (10, 11), (21, 5)]

Output: 5

Tips for Beginners

  • Focus on understanding the logic, not memorizing syntax
  • Use print statements to debug your code
  • Don't worry about input parsing - the function handles that for you
  • If stuck, try writing out your solution on paper first

Python Editor

Loading Python...