본문 바로가기

반응형

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

(70)
[백준 14501 c++ VO] 퇴사 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 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 14501 c++ VO] 퇴사 // 접근: 완전탐색으로 최대경우를 조사 -> 그때그때 더해지는 금액의 개수가 달라져서 단순 반복문으로 힘듦->완전탐색 재귀 또는 dfs // 날짜 중복 안고 다음 날짜부터 넘어감=start인덱스부터 재..
[백준 1759 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 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 1759 c++ O] 암호 만들기 // 문제: // 접근: 가능한 비밀번호 경우 추출 -> 완전탐색 해야하는데 비밀번호의 자릿수가 일정한 것이 아니므로 dfs/ 재귀 생각 // 오름차순=정렬+start인자,중복없음= 방문배열 없..
[백준 9095 c++ OOO] 1, 2, 3 더하기 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 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 9095 c++ OOO] 1, 2, 3 더하기 // 문제: 정수를 1,2,3의 합으로 나타내는 방법의 수를 출력 // 접근: 1,2,3 경우를 나눔 -> dp -> 탑다운 방식: 정수 i 가되는 경우 // 1.i-1 에서 ..
[백준 15657 c++ O] N과 M (8) 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 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 15657 c++ O] N과 M (8) // 문제: n개의 자연수를 입력받아 m개의 숫자를 이용해 수열을 구현해서 출력, 사전순출력->입력배열 정렬, 중복허용->방문배열 없음, 배내림차순=현재 수부터 큰수 탐색 // 접근1: 완전탐색 -> 재귀dfs..
[백준 15656 c++ O] N과 M (7) 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 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 15656 c++ O] N과 M (7) // 문제: n개의 자연수를 입력받아 m개의 숫자를 이용해 수열을 구현해서 출력, 사전순출력->입력배열 정렬, 중복허용->방문배열 없음 // 접근1: 완전탐색 -> 재귀dfs -> 재귀중간 순열 체크..
[백준 15655 c++ O] N과 M (6) 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 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 15655 c++ O] N과 M (6) // 문제: n개의 자연수증 m개의 숫자를 이용해 수열을 구현해서 출력,오름차순=입력배열 정렬하고 탐색 // 접근1: 완전탐색 -> 재귀dfs -> 재귀중간 순열 체크, 중복방지=방문배열,..
[백준 15654 c++ O] N과 M (5) 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 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include // memset 헤더 using namespace std; // [백준 15654 c++ O] N과 M (5) // 문제: n개의 자연수증 m개의 숫자를 이용해 수열을 구현해서 출력,중복방지,오름차순 // 접근1: 완전탐색 -> 재귀dfs -> 재귀중간 순열 체크, 중복방지=방문배열, 오..
[백준 15652 c++ O] N과 M (4) 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 #include // memset 헤더 #include using namespace std; // [백준 15652 c++ O] N과 M (4) // 접근1: 완전탐색 -> 재귀dfs -> 재귀중간 순열 체크, 중복허용이라 방문배열 필요없음 // 접근2: 완전탐색 -> 재귀 -> 전역배열로 인덱스 인자를 넘겨줌 -> 중복허용이..

반응형