UVa 10110 - Light, more light

Summary
Figure out how many times Mabu toggles the $$n$$th switch to figure out whether the switch is on or not.

Explanation
There are a few things you should immediately notice: With this in mind, how can we tell if a number has an even or odd number of factors? For every factor $$n$$ has below $$\sqrt{n}$$ it has one above $$\sqrt{n}$$. This suggests that unless $$n$$ is a perfect square, it has an even number of factors. So, the problem boils down to deciding if $$n$$ is a perfect square or not. Use your favorite math libraries to find the answer.
 * Once Mabu has done his $$n$$th walk, the $$n$$th switch is never toggled again.
 * The answer is yes iff the $$n$$th switch is toggled an odd number of times (otherwise, for each time it is turned on, it gets turned off, and is thus off in the end).
 * The $$n$$th switch is toggled once for each factor of $$n$$.

Implementation

 * 31-bit integer is not good enough for this problem. Use unsigned int.

Input
3 6241 8191 0

Output
no yes no