#C229. Automorphic Number Checker
Automorphic Number Checker
Automorphic Number Checker
An automorphic number is a number whose square ends with the number itself. In other words, if a number n satisfies the condition that the last k digits of n2 are exactly n (where k is the number of digits in n), then n is an automorphic number.
This can be formally expressed in LaTeX as: $$n^2 \equiv n \pmod{10^k}$$, where \(k\) is the number of digits in \(n\).
Your task is to determine whether a given integer is an automorphic number. Read an integer from the standard input, check if it is automorphic, and print True
if it is; otherwise, print False
.
inputFormat
The input consists of a single integer n provided via standard input.
outputFormat
The output should be either True
if the number is automorphic or False
if it is not. The output should be printed to standard output.
5
True