# UVa 10110

## Summary

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

## Explanation

There are a few things you should immediately notice:

• Once Mabu has done his ${\displaystyle n}$th walk, the ${\displaystyle n}$th switch is never toggled again.
• The answer is yes iff the ${\displaystyle 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 ${\displaystyle n}$th switch is toggled once for each factor of ${\displaystyle n}$.

With this in mind, how can we tell if a number has an even or odd number of factors? For every factor ${\displaystyle n}$ has below ${\displaystyle {\sqrt {n}}}$ it has one above ${\displaystyle {\sqrt {n}}}$. This suggests that unless ${\displaystyle n}$ is a perfect square, it has an even number of factors. So, the problem boils down to deciding if ${\displaystyle n}$ is a perfect square or not. Use your favorite math libraries to find the answer.

## Implementation

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

## Input

3
6241
8191
0


## Output

no
yes
no