Problem 2

1

1 votes
Problem

Julia has a sack full of red and yellow balls and wants to arrange them in a particular order as

defined below.

Let us consider two definitions -

Chroma-regularity - maximum number of objects of the same color that appear consecutively.

Min-Arrangement - An arrangement of the objects with minimum Chroma Regularity possible.

Given a sack full of only red and yellow balls find the required min-arrangement.

(Input – x and y one after the other and -1 or 0 to end

Output – one single integer)

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?