GIRLSNBS - Girls and Boys

题意翻译

一个即将毕业的班级里有G个女生和B个男生。你需要在毕业典礼上把它们排成一排。为了给人一种多样化的印象,你应该避免连续坐太多女孩或太多男孩。你决定安排学生是为了减少男女比例。排列的性别规律性是指连续出现的同性别学生(全是女生或全是男生)的最大数量。已知G和B,计算所有可能安排中最小的性别规律性。

题目描述

There are G girl students and B boy students in a class that is about to graduate. You need to arrange them in a single row for the graduation. To give a better impression of diversity, you want to avoid having too many girls or too many boys seating consecutively. You decided to arrange the students in order to minimize the gender regularity. The gender regularity of an arrangement is the maximum number of students of the same gender (all girls or all boys) that appear consecutively. Given G and B, calculate the minimum gender regularity among all possible arrangements.

输入输出格式

输入格式


Each test case is described using a single line. The line contains two integers G and B representing the number of girls and boys in the class, respectively (0

输出格式


For each test case, output a single line with a single integer representing the minimum gender regularity that an arrangement of G girls and B boys can have.

输入输出样例

输入样例 #1

10 10
5 1
0 1000
-1 -1

输出样例 #1

1
3
1000