Free help with homework

Why join Brainly?

  • ask questions about your assignment
  • get answers with explanations
  • find similar questions

There is a Grasshopper in a tropical forest. The grasshopper can jump only vertically and

horizontally, and the length of the jump is always equal to x centimeters. A Grassshopper has found herself at the center of some cell of the chess board of
the size p×q centimeters (each cell is 1×1 centimeters).
She can jump as
she wishes for an arbitrary number of times, she can even visit a cell more
than once. The only restriction is that she cannot jump out of the board.The Grasshopper can count the amount of cells that she can reach from the
starting position (x,y). Let's denote this amount by d(x,y). Your task is to
find the number of such starting positions (x,y), which have the
maximum possible value of d(x,y)

The integer array contains three integers p, q,x(1<=p,q,x<=10^6)
p = lenght of board
q = width of board
x = lenght of Grasshopper jump


: think first about the case x=1 for p,q fairly large (say 4). Clearly a center cell can reach four other cells. What cells cannot reach four other cells? Then, as in your first example, notice that if x is greater than p,q you can reach the same number of cells from any place on the board. What happens in the transition region. hope it is satisfing.
0 0 0
The Brain
  • The Brain
  • Helper
Not sure about the answer?
Learn more with Brainly!
Having trouble with your homework?
Get free help!
  • 80% of questions are answered in under 10 minutes
  • Answers come with explanations, so that you can learn
  • Answer quality is ensured by our experts