CF 1519A - Red and Blue Beans

We have two colors of beans, red and blue. Every packet we create must contain at least one bean of each color, and inside any packet the difference between the number of red and blue beans cannot exceed d. The question is whether all

CF 1519A - Red and Blue Beans

Rating: 800
Tags: math
Solve time: 59s
Verified: no

Solution

Problem Understanding

We have two colors of beans, red and blue. Every packet we create must contain at least one bean of each color, and inside any packet the difference between the number of red and blue beans cannot exceed d.

The question is whether all