목록Problem Solving (223)
Life Engineering
https://www.acmicpc.net/problem/10819 10819번: 차이를 최대로 첫째 줄에 N (3 ≤ N ≤ 8)이 주어진다. 둘째 줄에는 배열 A에 들어있는 정수가 주어진다. 배열에 들어있는 정수는 -100보다 크거나 같고, 100보다 작거나 같다. www.acmicpc.net #include #include #include #include #include using namespace std; int arr[10]; bool visit[10]; int answer = -1; vector v; int N; int calc() { int sum = 0; for (int i = 0; i > N; for (int i = 0; i > arr[i]; } dfs(0)..
https://www.acmicpc.net/problem/9663 9663번: N-Queen N-Queen 문제는 크기가 N × N인 체스판 위에 퀸 N개를 서로 공격할 수 없게 놓는 문제이다. N이 주어졌을 때, 퀸을 놓는 방법의 수를 구하는 프로그램을 작성하시오. www.acmicpc.net #include #include #include using namespace std; int board[16]; int answer = 0; bool promising(int col, int row) { //board[col]=row for (int i = 1; i N; backtracking(1, 0, N); cout
https://www.acmicpc.net/problem/15684 15684번: 사다리 조작 사다리 게임은 N개의 세로선과 M개의 가로선으로 이루어져 있다. 인접한 세로선 사이에는 가로선을 놓을 수 있는데, 각각의 세로선마다 가로선을 놓을 수 있는 위치의 개수는 H이고, 모든 세로선 www.acmicpc.net #include #include #include #define MAX 987654321 using namespace std; int N, M, H, a, b; int ladder[32][12]; int ans = MAX; bool isPossible() { for (int line = 1; line M >> H; for (int i = 0; i > a >> b; l..
https://programmers.co.kr/learn/courses/30/lessons/64065 코딩테스트 연습 - 튜플 "{{2},{2,1},{2,1,3},{2,1,3,4}}" [2, 1, 3, 4] "{{1,2,3},{2,1},{1,2,4,3},{2}}" [2, 1, 3, 4] "{{4,2,3},{3},{2,3,4,1},{2,3}}" [3, 2, 4, 1] programmers.co.kr #include #include #include #include using namespace std; vector v(500); bool cmp(vector &v1, vector &v2){ return v1.size()