One way:
The ball returned to the thrower's hand after 5 seconds. It spent 2.5 seconds going up, and 2.5 seconds coming back down.
Use the formula Distance = (1/2) (acceleration) (time squared)
Distance = (1/2) (gravity) (2.5 sec)
Distance = (1/2) (9.8 m/s ²) (6.25 sec² )
Distance = (4.9 m/s²) (6.25 sec²)
Distance = 30.63 meters
Another way:
The thrower threw the ball straight up at 25 m/s.
It sailed upward for 2.5 seconds.
At the top of its trip, before it started falling, its speed was zero.
Its average speed was (1/2) (25+0) = 12.5 m/s
At an average speed of 12.5 m/s for 2.5s, the ball rose (12.5x2.5) = 31.25m.
(Why are the two answers different ?
Because if the ball was thrown straight up at 25 m/s, it would actually return to the thrower in 5.1 seconds, not 5.0 seconds.
So if you use the acceleration of gravity to solve the problem, you get one answer, but if you use 5.0sec to solve it, you get a slightly different one.)