/*
 * A program that reads the number of floors f and the number of b balls, and
 * prints out the minimum number of experiments required.
 */

#include <stdio.h>

int comp_floors(int exprs, int balls)
{
  if (balls == 0)
    return 0;
  if (exprs == 0)
    return 0;
  return comp_floors(exprs - 1, balls) + comp_floors(exprs - 1, balls - 1) + 1;
}

int main()
{
  int floors, exprs, balls;
  printf("Enter number of floors followed by number of balls: ");
  if (scanf("%d %d", &floors, &balls) != 2) {
    printf("ERROR: cannot read input!\n");
    return -1;
  }
  for (exprs = 0; 1; exprs++) {
    if (comp_floors(exprs, balls) >= floors)
      break;
  }
  printf("Required %d exprs\n", exprs);
  return 0;
}
