๋ฌธ์
https://www.acmicpc.net/problem/15649
15649๋ฒ: N๊ณผ M (1)
ํ ์ค์ ํ๋์ฉ ๋ฌธ์ ์ ์กฐ๊ฑด์ ๋ง์กฑํ๋ ์์ด์ ์ถ๋ ฅํ๋ค. ์ค๋ณต๋๋ ์์ด์ ์ฌ๋ฌ ๋ฒ ์ถ๋ ฅํ๋ฉด ์๋๋ฉฐ, ๊ฐ ์์ด์ ๊ณต๋ฐฑ์ผ๋ก ๊ตฌ๋ถํด์ ์ถ๋ ฅํด์ผ ํ๋ค. ์์ด์ ์ฌ์ ์์ผ๋ก ์ฆ๊ฐํ๋ ์์๋ก ์ถ๋ ฅํด
www.acmicpc.net
ํ์ด
# ๋ฐฑ์ค 15649๋ฒ ๋ฌธ์ - N๊ณผ M(1)
n, m = map(int, input().split())
s = []
def solution():
if len(s) == m:
print(' '.join(map(str, s)))
return
for i in range(1, n+1):
if i in s:
continue
s.append(i)
solution()
s.pop()
solution()
'๐๏ธ Algorithm > ๐ฉ ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค] [Python] 1912๋ฒ_์ฐ์ํฉ_๋์ ํ๋ก๊ทธ๋๋ฐ (0) | 2022.09.16 |
---|---|
[๋ฐฑ์ค] [Python] 1904๋ฒ_01ํ์ผ_๋์ ํ๋ก๊ทธ๋๋ฐ (0) | 2022.09.16 |
[๋ฐฑ์ค] [Python] 10845๋ฒ_ํ (0) | 2022.03.24 |
[๋ฐฑ์ค] [Python] 1920๋ฒ_์ ์ฐพ๊ธฐ (0) | 2022.03.19 |
[๋ฐฑ์ค] [Python] 7568๋ฒ_๋ฉ์น (0) | 2022.03.18 |