Skip to content

Commit 08717cb

Browse files
committed
[BOJ] 카드 놓기 / 실버4 / 30분
https://www.acmicpc.net/problem/5568
1 parent 1fee687 commit 08717cb

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
n = int(input())
2+
k = int(input())
3+
4+
card = []
5+
dp = [0] * n
6+
7+
result = 0
8+
9+
for _ in range(n):
10+
card.append(int(input()))
11+
12+
string = ''
13+
result = set()
14+
15+
16+
def select(cnt):
17+
global string
18+
19+
if cnt == k:
20+
result.add(string)
21+
return
22+
23+
for i in range(n):
24+
if dp[i] == 0:
25+
dp[i] = 1
26+
27+
tmp = str(card[i])
28+
string += tmp
29+
30+
select(cnt + 1)
31+
32+
dp[i] = 0
33+
string = string[:-len(tmp)]
34+
35+
36+
select(0)
37+
print(len(result))

0 commit comments

Comments
 (0)