티스토리 뷰
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int map[100][100];
int node_num;
int path[5] = { 0 };
void input() {
cin >> node_num;
for (int i = 0; i < node_num; i++) {
for (int j = 0; j < node_num; j++) {
cin >> map[i][j];
}
}
}
void run(int num, int lev) {
if (lev == 2) {
for (int i = 0; i < 3; i++) {
cout << path[i] << ' ';
}
cout << '\n';
return;
}
for (int i = 0; i < node_num; i++) {
if (map[num][i] == 1) {
int next = i;
path[lev+1] = i;
run(next,lev+1);
path[lev + 1] = 0;
}
}
}
int main() {
path[0] = 0;
input();
run(0,0);
return 0;
}
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- @Value
- @Spring
- Thymeleaf
- lowerBound
- 백준
- JPA
- springboot
- 메인메소드
- Optional
- id생성전략
- 생성자
- ddl-auto
- N+1문제
- StreamAPI
- uncheckedException
- NPE
- 오블완
- null
- 동등성
- 일급컬렉션
- @ConfigurationProperties
- Spring
- checkedException
- Java
- upperBound
- 유효성 검사
- 이진탐색
- 자바
- 티스토리챌린지
- @NoArgsConstructor
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함