본문 바로가기

반응형

Algorithm_BOJ(백준)/완전탐색(Brute Force)

(70)
[백준 2501 c++ O] 약수 구하기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #define _CRT_SECURE_NO_WARNINGS #include #include #include // memset 헤더 using namespace std; // [백준 2501 c++ O] 약수 구하기 // 문제: // 접근: // 풀이: int n, k; vector a; int main() { ios::sync_with_stdio(false); // 계산시간 단축 // cin,scanf 같이 쓰면 오류 cin.tie(nullptr); cout.tie(nullptr);// 입출력 시간 단축 // 이것을 쓰면 scanf,printf섞어 쓰면 안됨 cin >> n >> k; for (int..
[백준 2529 c++ VV] 부등호 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 #include using namespace std; // [백준 2529 c++ VV] 부등호 // 문제: 주어진 부등호를 만족시키는 수열중 최대,최소값 구하기 // 접근: 최대,최소-> 그리디,dp 모르겟음 -> 완전탐색 재귀 -> //..
[백준 9663 c++ V] N-Queen 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 9663 c++ V] N-Queen // 문제: 이차원 그래프에 모든 행에 퀸을 놓는 방법의 수 // 접근: 이차원 그래프 모든 방법 -> 완탐,dfs,bfs -> 모든 경우이므로..
[백준 16198 c++ O] 에너지 모으기 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 51 52 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 16198 c++ O] 에너지 모으기 // 문제: // 접근: 무게 합의 최댓값-> 완탐,그리디,dp -> n 완탐 재귀 // 시간복잡도: O((n-2)!) = 8! // 풀이: // 재귀 모든경우 // 1.가능한 경우 : 끝까지 고른 경우 // 2.불가..
[백준 16197 c++ V] 두 동전 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 #include using namespace std; // [백준 16197 c++ V] 두 동전 // 문제: 이차원..
[백준 14500 c++ OVO] 테트로미노 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 14500 c++ OVO] 테트로미노 // 문제: ..
[백준 15658 c++ O] 연산자 끼워넣기 (2) 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 15658 c++ O] 연산자 끼워넣기 (2) // 문제: 가능한 연산자의 계산 결과 중 최대,최소 구하기 // 접근: 가능한 계산결과 중 최대 최소 -> 완탐,그리디,dp -> 완탐(..
[백준 14888 c++ O] 연산자 끼워넣기 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 51 52 53 54 55 56 57 58 59 60 61 62 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 14888 c++ O] 연산자 끼워넣기 // 문제: 가능한 연산자의 계산 결과 중 최대,최소 구하기 // 접근: 가능한 계산결과 중 최대 최소 -> 완탐,그리디,dp -> 완탐(재귀 조합) -> 각 4..

반응형