Content Too Large

ABC 413

Problem 3 of 50

Easy

What to do

Takahashi has a bag and several items. He wants to know if he can fit all the items in the bag without exceeding its size limit. If the total size of the items is less than or equal to the bag's size, he can fit them all; otherwise, he cannot.

Key Concepts

if-statements basic math (addition) input and output

Examples

Input: [3, 1, 4, 1, 5], 15

Output: Yes

Input: [3, 1, 4, 1, 5], 5

Output: No

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...