C++20 sections · 1024 units
Open in Course

Problem - Watermelon

First CF problem

I'll show you a classic problem about divisibility. Given a watermelon of weight ww kilograms, you need to check if two people can split it into two parts where both parts have even weight.

The constraint is simple: each person must get a positive even number of kilograms. This means you can't give someone zero kilograms, and you can't give someone an odd number. Think about what conditions must be true for a valid split to exist.

What does the total weight tell you about possible splits?