# 뒤집은 소수
def reverse(x):
x = str(x)
x = x[::-1]
return int(x)
def reverse(x):
res = 0
while x > 0:
res = res * 10 + x % 10
x //= 10
return res
def isPrime(x):
if x == 1:
return False
i = 2
while i * i <= x:
if x % i == 0:
return False
i += 1
return True
N = int(input())
nums = list(map(int, input().split()))
for x in nums:
x = reverse(x)
if isPrime(x):
print(x, end=" ")
'파이썬 알고리즘 (인프런) > 코드 구현력 기르기' 카테고리의 다른 글
10. 점수계산 (0) | 2021.01.06 |
---|---|
9. 주사위 게임 (0) | 2021.01.06 |
7. 소수 (에라토스테네스 체) (0) | 2021.01.06 |
6. 자릿수의 합 (0) | 2021.01.06 |
5. 정다면체 (0) | 2021.01.06 |