일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Splunk
- dataframe
- pip
- SciPy
- javascript
- imread
- Python
- synology
- RNN
- GitHub
- 알고리즘
- GT-S80
- install
- ipad
- keras
- E-P1
- SPL
- Numpy
- pycharm
- DFS
- Series
- Button
- pandas
- LSTM
- CNN
- 삼성소프트웨어멤버십
- mariadb
- Lotto
- mean
- index
Archives
- Today
- Total
잠토의 잠망경
[알고리즘] 순열 본문
조합
요소 : 1, 2, 3, 4 의 조합가능한 경우의 수를 만들어낸다.
int visit[MAXS];
int sample[MAXS];
// now는 sample에 저장될 위치이다.
void dfs(int now)
{
if (now >= S)
{
for (int i = 1; i <= S; i++)
printf("%d ", sample[i]);
printf("\n");
// 필요하다면 여기서 연산하면 된다.
// 조합된 결과를 여기서
}
for (int i = 1; i <= S; i++)
{
// 중복으로 걸리는걸 막는다.
if (visit[i] != 0)
continue;
sample[now] = shipSize[i];
visit[i] = 1;
dfs(now + 1);
visit[i] = 0;
}
}
dfs(0);
Comments