Additive Primes
면접 대비시간 제한1초메모리 제한2048 MB
정수 n이 주어질 때 n이 소수인지와 각 자리 숫자의 합이 소수인지를 판별해 해당 분류를 출력한다.
문제
A prime number is an integer () such that cannot be formed as the product of two other integers smaller than . In other words, a number is prime if its factors are only one and itself. An integer which is greater than and is not prime is called a composite number.
An additive prime in base- is a number which is both prime and the sum of its digits forms a prime number. For example, is an additive prime, since is prime, and is also prime, but is not, since , and is not prime.
입력
Input consists of a single integer ().
출력
Output "ADDITIVE PRIME" if the number is an additive prime. Output "PRIME, BUT NOT ADDITIVE" if the number is prime, but not an additive prime. Output "COMPOSITE" otherwise.