Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- error
- 타입스크립트
- Operating System
- react
- 알고리즘
- C++
- 공부
- 토이프로젝트
- codeup
- 백준
- 자료구조
- Redux
- OS
- 정렬
- 스프링
- memory
- 협업
- web
- 프로그래머스
- Spring
- Java
- 리덕스장바구니
- react-redux
- js to ts
- 코드업
- 일상
- CPU 스케줄링
- 파이썬
- 기초100제
- 분할메모리할당
Archives
- Today
- Total
목록백트래킹 (1)
감자튀김 공장🍟
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Ef784/btrU3aUar8P/LDkgKjDDCKy4uZA9mk3910/img.png)
✔ 문제 ✔ 풀이 import sys input = sys.stdin.readline n = int(input()) graph = [0] * n count = 0 def is_promising(x): for i in range(x): if graph[x] == graph[i] or abs(graph[x] - graph[i]) == x - i: return False return True def queen(x): global count if x == n: count += 1 return else: for i in range(n): graph[x] = i if is_promising(x): queen(x+1) queen(0) print(count) ✔ 설명 #Tip 1. 굳이 2차원 배열을 쓸 필요가 없다...
Algorithm/BOJ
2023. 1. 1. 20:56