#C11856. Combine Fruit Baskets
Combine Fruit Baskets
Combine Fruit Baskets
You are given two baskets containing fruit items. Each basket is represented by an integer indicating the number of fruit items it contains. The two baskets can be combined if the total number of fruit items does not exceed 100. However, each basket must contain at least 1 and at most 100 items.
Your task is to determine if the baskets can be combined according to these restrictions.
Formally, let \(a\) and \(b\) be the number of items in basket 1 and basket 2 respectively. You must check the following conditions:
- Both \(a\) and \(b\) must satisfy \(1 \leq a, b \leq 100\).
- The sum \(a+b\) must be less than or equal to \(100\).
If the input does not consist of exactly two integers, or if any of the above conditions fail, output NO
. Otherwise, output YES
.
inputFormat
The input is provided via standard input (stdin) as two space-separated integers representing the number of fruit items in each basket. Ensure that exactly two integers are provided.
outputFormat
Output, to standard output (stdout), a single string: either "YES" if the baskets can be combined according to the rules, or "NO" otherwise.## sample
30 40
YES
</p>