II. (35 points) A stationery store that operates both wholesale and retail has stipulated: If a customer buys 51 pencils or more (including 51), they will be charged at the wholesale price; if they buy 50 pencils or fewer (including 50), they will be charged at the retail price. The wholesale price for 60 pencils is 1 yuan cheaper than the retail price for 60 pencils. Now, a class monitor, Xiao Wang, comes to buy pencils. If he buys one pencil for each student in the class, he must pay the retail price, which costs $m$ yuan ($m$ is a positive integer); but if he buys 10 more pencils, he can pay the wholesale price, which also costs exactly $m$ yuan. How many students are there in Xiao Wang's class?
Get $x=-5+\sqrt{25+600 m}$,
$(25+600 m)$ is a perfect square.

From $40<-5+\sqrt{25+600 m} \leqslant 50$,
we get $3 \frac{1}{3}<m \leqslant 5$.
When $m=4$, $25+600 m$ is not a perfect square, discard it.
When $m=5$, $x=50$ is the solution.
Second, let the class have $x$ students, then the retail price of pencils is $\frac{m}{x}$ yuan, and the wholesale price is $\frac{m}{x+10}$ yuan. According to the problem, we have the equation
$$
\frac{60 m}{x}-\frac{60 m}{x+10}=1,
$$

which is $x^{2}+10 x-600 m=0$,
where $40<x \leqslant 50$.