Cryptography
면접 대비시간 제한1초메모리 제한2048 MB
주어진 정수 n(최대 10^10)이 소수인지 판별해 소수이면 SAFE, 아니면 BROKEN을 출력한다.
문제
Dave has just completed the Massive Open Online Course (MOOC) Cryptography on the popular website Coursera.org. Eager to create his own cryptography system -- against the advise of the teacher Dan Boneh to never, ever, ever implement your own crypto-system -- he searches for a SKP (Special Key Prime). A SKP is a prime that is preferably a large number, because the larger the number the more secure it is to use as a key.
Remember that a prime is a number that is only divisible by 1 and itself. For example 2 is a prime because it's only divisible by 1 and 2. 15 however is not a prime since beside 1 and 15, also 3 and 5 happen to divide this number. The number 1 is considered to not be a prime.
Luckily his friend Trudy is quite good at guessing large numbers that could be prime. Your task is given a number by Trudy, to decide whether this is actually a prime or not.
입력
You are given a number , the number that Trudy has guessed for Dave to use as a SKP.
출력
You should output "SAFE" (without the quotes) iff the number is a prime, else your program should output "BROKEN" (again, without the quotes).