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