티스토리 뷰
#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
- Java
- @Spring
- springboot
- Optional
- 유효성 검사
- 오블완
- N+1문제
- 백준
- JPA
- @ConfigurationProperties
- lowerBound
- 자바
- null
- Thymeleaf
- 생성자
- StreamAPI
- ddl-auto
- 이진탐색
- upperBound
- 일급컬렉션
- checkedException
- 메인메소드
- 동등성
- id생성전략
- 티스토리챌린지
- uncheckedException
- @Value
- NPE
- Spring
- @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 |
글 보관함