Skip to content

Commit c7cf223

Browse files
author
hangyeol
committed
126차 1번 문제풀이
1 parent 3cb98e7 commit c7cf223

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from itertools import permutations
2+
3+
4+
def solution(numbers):
5+
numberSet = set()
6+
7+
for i in range(1, len(numbers) + 1):
8+
for p in permutations(numbers, i):
9+
num = int(''.join(p))
10+
numberSet.add(num)
11+
12+
count = 0
13+
14+
for num in numberSet:
15+
if num < 2:
16+
continue
17+
isPrime = True
18+
19+
for i in range(2, int(num ** 0.5) + 1):
20+
if num % i == 0:
21+
isPrime = False
22+
break
23+
24+
if isPrime:
25+
count += 1
26+
27+
return count

0 commit comments

Comments
 (0)