There is no solution because x is incorrect.
x should be 32
The amount of balls in a given layer can be found by squaring the layer it is in
4 layers
top layer (1st) is 1
2nd is 4
3rd layer is 9
4th is 16
add them up
1+4+9+16=30
30 in that pyramid
According to my calculations the answer is 19.5 or 19.50 you can pick either one but your teacher will probably want the first.
Not sure hope you get the answer from someone else