No.2185 Last 6 Digits of a Square Number
Problem Statement
You are given as input a string $S$ of $6$ characters consisting only of the half-width alphanumeric characters from $0$ to $9$.
Determine whether there exists a square number with $7$ or more digits whose last $6$ digits are equal to $S$.
Input
The input is given from standard input in the following format:
$S$
Constraints
The input satisfies the following constraints:
- $S$ is a string of $6$ characters consisting only of the half-width alphanumeric characters from $0$ to $9$
Output
Print YES if there exists a square number with $7$ or more digits whose last $6$ digits are equal to $S$, and NO otherwise.
Print a newline at the end.
Sample
Sample 1
Input
000000
As shown here, the input may begin with $0$.
Output
YES
An example of a square number with $7$ or more digits whose last $6$ digits are equal to $000000$ is $1000000 = 1000^2$.
Sample 2
Input
000001
Output
YES
An example of a square number with $7$ or more digits whose last $6$ digits are equal to $000001$ is $1000002000001 = 1000001^2$.
Sample 3
Input
000002
Output
NO
There is no square number with $7$ or more digits whose last $6$ digits are equal to $000002$.
Sample 4
Input
864656
Output
YES
An example of a square number whose last $6$ digits are equal to $864656$ is
$\displaystyle 10596290312864656 = 102938284^2 $
.
Sample 5
Input
830823
Output
NO
There is no square number with $7$ or more digits whose last $6$ digits are equal to $830823$.
Related Problems
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。