일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- C++ 1937
- 인덱스 트리
- 16933
- DFS
- C++
- 다익스트라
- 백준 숨바꼭질5
- 프로그래머스
- 순열
- 가장 긴 증가하는 부분 수열
- 조합론
- BFS
- DP
- 소트 게임
- C++ 17071
- C++1967
- 투포인터
- Backtracking
- 백준
- 문자열
- c언어
- C++ 1918
- 백준 17071
- LIS
- 백트래킹
- 위상정렬
- 조합
- strtok
- C++1167
- 알고리즘
- Today
- Total
목록조합 (3)
블로그
https://www.acmicpc.net/problem/2407 2407번: 조합 n과 m이 주어진다. (5 ≤ n ≤ 100, 5 ≤ m ≤ 100, m ≤ n) www.acmicpc.net 큰 수 다루는 문제를 한 번도 정리 안 한거 같아서.. 아 그리고 문자열 뒤집는 함수인 reverse 가 에 있는 줄 알고 썼는데 에 있는 거더라 으음.. #include #include #include using namespace std; string pas[101][101]; string string_hap(string s1, string s2) { string ret = ""; int tmp = 0; int s1_len = s1.length(); int s2_len = s2.length(); for (int..
골드 Ⅴ #include #include #include using namespace std; int N, M; int map[8][8]; int testmap[8][8]; vector emptys; vector viruses; int ans = -1; void maketestmap() { for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { testmap[i][j] = map[i][j]; } } } int calculatesize() { int cnt = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if (testmap[i][j] == 0) cnt++; } } return cnt; ..

*모든 예시는 A, B, C, E, D의 다섯 원소 중 3개의 원소를 뽑는 것으로 다루었습니다 순열(nPm): 순서가 의미 있는 선택 -> "ABC"와 "ACB"를 다르게 취급하겠다는 것 "순서가 의미 있다" ==> 순서가 바뀌면 다른 것, 다른 경우가 된다 (A -> B -> C의 순서로 뽑음, A -> C -> B의 순서로 뽑음) #include #include using namespace std; int n, m; vector nPm; bool is_in[9]; void backtracking() { if (nPm.size() == m) { for (int i : nPm) printf("%d ", i); printf("\n"); return; } for (int i = 1; i "ABC"와 "ACB..