| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 46 | 38 | 32 | 80.000% |
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.
61
ADDITIVE PRIME
17
PRIME, BUT NOT ADDITIVE
141
COMPOSITE
School > CS@Mines > CS@Mines HSPC 2018 H번