We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3cb98e7 commit 699e985Copy full SHA for 699e985
1 file changed
live12/test126/문제1/박희경.py
@@ -0,0 +1,21 @@
1
+from itertools import *
2
+
3
+def is_prime(num):
4
+ if num < 2: return False
5
+ for i in range(2, int(num**0.5) + 1):
6
+ if num % i == 0: return False
7
+ return True
8
9
+def solution(numbers):
10
+ answer = 0
11
+ num_set = set()
12
+ for i in range(1, len(numbers) + 1):
13
+ for perm in permutations(numbers, i):
14
+ num = int(''.join(perm))
15
+ num_set.add(num)
16
17
+ for p in num_set:
18
+ if is_prime(p):
19
+ answer += 1
20
21
+ return answer
0 commit comments