Блог пользователя emli

Автор emli, 14 лет назад, По-английски
http://www.spoj.pl/problems/GIRLSNBS/

Do you have any idea? it seems very simple but ....
  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

14 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
The concept is very simple...
Assuming that there no. of boys (b) < no. of girls (g), then, we have b + 1 places where we can fills groups of girls. To minimize the number of girls in a line, we shall try to distribute them equally, i.e., g / (b + 1) girls everywhere.

If g % (b + 1) != 0, then we shall distribute g % (b + 1) girls in those many places and the answer then becomes g / (b + 1) + 1.

Trivial cases, g = b, answer is 1.
g or b = 0, answer is b or g respectively.