시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB56474081.633%

문제

A prime number is an integer $n$ ($n \ge 2$) such that $n$ cannot be formed as the product of two other integers smaller than $n$. In other words, a number is prime if its factors are only one and itself. An integer which is greater than $2$ and is not prime is called a composite number.

An additive prime in base-$10$ is a number which is both prime and the sum of its digits forms a prime number. For example, $23$ is an additive prime, since $23$ is prime, and $2 + 3 = 5$ is also prime, but $13$ is not, since $1 + 3 = 4$, and $4$ is not prime.

입력

Input consists of a single integer $n$ ($2 \le n \le 2^{31} - 1$).

출력

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.

예제 입력 1

61

예제 출력 1

ADDITIVE PRIME

예제 입력 2

17

예제 출력 2

PRIME, BUT NOT ADDITIVE

예제 입력 3

141

예제 출력 3

COMPOSITE

출처

School > CS@Mines > CS@Mines HSPC 2018 H번

  • 문제를 만든 사람: Jack Rosenthal