Skip to content

Commit 888497e

Browse files
committed
[BOJ] 15651 N과 M (3) (S3)
1 parent 248f5e8 commit 888497e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

심수연/8주차/260216.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://www.acmicpc.net/problem/15651
2+
3+
import sys
4+
from itertools import product
5+
input = sys.stdin.readline
6+
7+
N, M = map(int, input().split())
8+
9+
nums = [i for i in range(1, N+1)]
10+
11+
perm = list(product(nums, repeat=M))
12+
# [(1, 1), (1, 2), (1, 3), (1, 4), (2, 1), (2, 2), (2, 3), (2, 4), (3, 1), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3), (4, 4)]
13+
14+
for num in perm:
15+
for i in num:
16+
print(i, end=' ')
17+
print(end = '\n')

0 commit comments

Comments
 (0)