dfs

알고리즘 문제 풀이/1DP_과제(~180615)

180130_10026_적록색약

//https://www.acmicpc.net/problem/10026 #include #include using namespace std;char picture[100][100];bool visit[100][100];bool visitbi[100][100];int n, cnt;int dy[4]={1,-1,0,0};int dx[4]={0,0,-1,1}; void dfs(int y, int x, char c){ visit[y][x]=1; for(int i=0; i=0 && ny=0 && nx> n; //input for(int i=0; i> picture[i]; for(int i=0; i

알고리즘 문제 풀이/1DP_과제(~180615)

180126_2819_격자판의 숫자 이어 붙이기

#include using namespace std;int map[4][4];bool visitednum[10000000];int dy[4]={0,0,1,-1};int dx[4]={1,-1,0,0}; int cnt; int dfs(int y, int x, int depth, int now){ if(depth==7) { if(!visitednum[now]) {visitednum[now]=1; cnt++;} return 0; } now*=10; now+=map[y][x]; for(int i=0; i=0 && ny=0 && nx> tc; for(int t=1; t

알고리즘 문제 풀이/1DP_과제(~180615)

171212_6603_로또

//https://www.acmicpc.net/problem/6603 #include using namespace std;int lotto[7];int S[14];bool visit[13]={0,};int k;bool chk; void dfs(int n,int cnt){ visit[n]=1; for(int i=1; ;i++) { int nn=n+i; lotto[cnt]=S[nn]; if(cnt==6) { for(int i=0; i k; if(!k) break; for(int i=1; i> S[i]; dfs(0,0); cout

알고리즘 문제 풀이/1DP_과제(~180615)

171123_2573_빙산

#include using namespace std;int map_melting[302][302];int map_origin[302][302];bool visit[302][302]; int dx[4]={1,-1,0,0};int dy[4]={0,0,1,-1}; void dfs(int y, int x){ visit[y][x]=1; for(int i=0; i

bong sue
'dfs' 태그의 글 목록 (3 Page)