![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/bC2RmQ/btqF1RP5A5O/DHxFRZsxdR8WKZGfxQEQtk/img.png)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 N, M = map(int, input().split()) check_list = [False]*N num_list = [i for i in range(1,N+1)] output = [] def permutation(count): if count == M: print(*output) return for i in range(N): if check_list[i] == True: continue output.append(num_list[i]) permutation(count+1) check_list[i] = True output.pop() for j in range(i+1,N): check_list..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/qwbCW/btqF0Q5VucW/kaaRbCPs115ah6O55XoAKk/img.png)
123456789101112131415161718N, M = map(int, input().split()) num_list = [i for i in range(1,N+1)] output = [] def permutation(count): if count == M: print(*output) return for i in range(N): output.append(num_list[i]) permutation(count+1) output.pop() permutation(0)cs
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/zswrq/btqF2SVhEeg/bES7TwuBM968shuK9uNfwk/img.png)
# 직접 작성한 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 N, M = map(int, input().split()) check_list = [False]*N num_list = [i for i in range(1,N+1)] output = [] result = [] def permutation(count): if count == M: if [*check_list] not in result: result.append([*check_list]) return for i in range(N): if check_list[i] == True: continue output.append(num_lis..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/beQtHr/btqF2StJACW/FuIYkLTmW2LRkcugWtZYI0/img.png)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 N, M = map(int, input().split()) check_list = [False]*N num_list = [i for i in range(1,N+1)] output = [] def permutation(count): if count == M: print(*output) return for i in range(N): if check_list[i] == True: continue output.append(num_list[i]) check_list[i] = True permutation(count+1) output.pop() check_list[i] = False permutation(0)..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/dbPr1p/btqFZx5q9ph/jJ6Wgk8Rxnk2K3Zq3XPXg0/img.png)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import sys test_case = int(input()) members = [] count = 1 for case in range(test_case): age, name = sys.stdin.readline().strip().split() age = int(age) members.append([age, name, count]) count += 1 members = sorted(members, key=lambda x: (x[0], x[2])) for member in members: print(member[0], member[1]) cs
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/xMCHu/btqFXImmtJK/0SZ68eTmkTKdkSEKA2r48k/img.png)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys test_case = int(input()) word_list = set() # 집합형 자료구조 사용 for case in range(test_case): word = sys.stdin.readline().strip() word_list.add(word) # set 자료구조에는 append가 아닌 add를 사용 # 단어의 길이로 정렬 + 길이가 같은 경우 사전순으로 word_list = sorted(word_list, key=lambda x: (len(x),x)) for word in word_list: print(word) Colored by Color Scripter cs # 중복된 단어 출력을 피하기 위해 set 자료구조..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/BwLFI/btqFZ5m3N3O/Wo3kXRbviDiWH6oAarQEOK/img.png)
1 2 3 4 5 6 7 8 9 10 11 import sys test_case = int(input()) xy_list = [] for case in range(test_case): x, y = list(map(int, sys.stdin.readline().strip().split())) xy_list.append([x,y]) a = sorted(xy_list, key= lambda x: (x[1],x[0])) for i in a: print(*i) Colored by Color Scripter cs # 두번째 열부터 정렬해야 하기 때문에 lambda 함수로 x[1], x[0]을 반환하여 정렬한다.
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/bJsOyy/btqFT8ZFcZa/7tkjF9vCIWSK0IwnzkMD8k/img.png)
# collections 모듈의 Counter 메소드를 쓰지 않는 방법 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 import sys max_size = 4000 # 입력되는 정수의 절댓값은 4000을 넘지 않는다. def artithmetic_mean(num_list): # 산술평균 sum = 0 for i in num_list: sum += i return int(round(sum/len(num_list),0)) def median_value(num_list): # 중앙값 num_list.sor..
- Total
- Today
- Yesterday
- Redux Thunk
- 우아한테크코스
- 다라쓰
- 리액트 리덕스
- contentEditable focus
- 리액트 props
- Browser Router
- 우테코
- 리액트 리스트 key
- props를 변경하지 못하는 이유
- 프론트
- 해쉬 라우터
- 리액트 리스트 키
- 브라우저 라우터
- 리덕스 썽크
- 백준
- Hash Router
- mkcert
- 리액트 jsx
- 인사이트
- 1463
- localhost https
- React key
- 리액트 키
- 프론트엔드
- 리액트 동작원리
- 댓글 모듈
- Python
- props를 변경하지 않는 이유
- 파이썬
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |