A structural engineer is auditing a small three-beam support bracket used in modular scaffolding. The bracket has one main beam (the root) resting on top of exactly two branch beams (the left branch and the right branch). Building code requires the main beam's rated load capacity to be exactly equal to the sum of the rated capacities of the two branches beneath it — no more and no less. Given the three rated capacities, determine whether this bracket satisfies the code.
A single line containing three space-separated integers: rootCapacity, leftCapacity, rightCapacity.
Print YES if rootCapacity equals leftCapacity plus rightCapacity, otherwise print NO.
1 <= rootCapacity, leftCapacity, rightCapacity <= 10000
Example 1
Input
10 4 6
Expected
YES
Explanation
The left branch's capacity of 4 plus the right branch's capacity of 6 sums to 10, which matches the root beam's capacity of 10, so the bracket passes the check: YES.
Example 2
Input
5 2 6
Expected
NO
Explanation
The left and right branch capacities sum to 2+6=8, which does not equal the root beam's capacity of 5, so the bracket fails the check: NO.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →