# 6603번 - 로또

- Author: @mildsalmon
- Published: 2021-12-16
- Updated: 2021-12-16
- Source: http://blex.me/@mildsalmon/6603%EB%B2%88-%EB%A1%9C%EB%98%90
- Tags: 파이썬, 알고리즘, 코딩테스트, 문제, 백준, 조합론

---

# 1. 로또

- 난이도
	- 실버 2
- 시간 제한
	- 1초
- 메모리 제한
	- 128MB
- 출처
	- [6603번: 로또 (acmicpc.net)](https://www.acmicpc.net/problem/6603)

### A. 📜 문제

위 백준 사이트에 접속하여 문제를 확인해주세요.

### B. 💡 내 답안

##### a. 😊 1차 시도 (성공)

```python

"""
Date    : 2021.12.16
Update  : 2021.12.16
Source  : 6603.py
Purpose : 조합 문제
Author  : 김학진 (mildsalmon)
Email   : mildsalmon@gamil.com
"""

def input_check(tc):
    if tc == '0':
        return None
    return tc

from itertools import combinations

if __name__ == "__main__":

    while True:
        temp = input()

        if input_check(temp) is None:
            break
        else:
            k, S = list(temp.split(' ', 1))
            S = list(map(int, S.split(' ')))

            combi = list(combinations(S, 6))

            for c in combi:
                print(*c, sep=' ')
        print()

```

##### b. 😊 다른 사람의 풀이

```python

from itertools import combinations
import sys
input=sys.stdin.readline

while 1:
    arr = input().split()

    if arr.pop(0) == '0':
        break

    for i in combinations(arr, 6):
        print(" ".join(i))

    print()

```

##### a. 🙄 회고

> 내 풀이

- 조합으로 풀었다.

### C. 🧐 문제 해설

> 이해한 내용을 바탕으로 작성했습니다.

`split()`은 두번째 인자로 split할 지점을 받는다고 한다. 그래서 이번 문제에서는 이 방식을 활용하여 풀어보려고 했다.

'7', '1 2 3 4 5 6 7' 이렇게 문자가 나눠지기 때문에 S 문자열은 따로 `split(' ')`을 다시 해주어야한다.

# 참고문헌

[baekjoon](https://www.acmicpc.net/user/baekjoon). [6603번: 로또 (acmicpc.net)](https://www.acmicpc.net/problem/6603). Baekjoon. (accessed Dec 16, 2021)
