#K57482. Almost Prime Check
Almost Prime Check
Almost Prime Check
An integer is called almost prime if it has exactly three distinct divisors. It turns out that a number has exactly three distinct divisors if and only if it is the square of a prime number.
Your task is to determine whether a given integer k is almost prime. In other words, check if k can be written as p2 where p is a prime number.
The answer should be YES
if k is almost prime and NO
otherwise.
Note: Please use the standard input (stdin) to read input and standard output (stdout) to print out your answer. If k is not the square of a prime, print NO
.
inputFormat
The input consists of a single integer k (1 ≤ k ≤ 1012) provided on a single line.
outputFormat
Output a single line containing either YES
if the number is almost prime, or NO
otherwise.
4
YES