백준 1938 통나무 옮기기
#include #include #include #include #include using namespace std; struct pt {int x;int y;int d; pt(int a, int b, int c) :x(a), y(b), d(c) {} }; int n; char board[53][53];int visited[52][52][2];int dist[52][52][2]; vector avail(const pt& cur){vector ret; int dd[4][2] = { { -1,0 },{ 0,1 },{ 1,0 },{ 0,-1 } };bool res[4] = { 0 };bool range = true;for (int i = 0; i
2018. 3. 19.
백준 4963 섬의 개수
/*1611 유기농 배추1654 401012 번문제입니다.배추를 흰지렁이의 마리 수를 출력하세요. 섬의 갯수를 세는 문제와 동일 합니다.1이 있는 곳에서 갈 수 있는 곳에 비지트 처리를 하고,또 다른 1을 찾아서 비지트 처리를 하고 이런식으로하면서 cnt++ 를 visit 에 넣으면 됩니다. 오께이. */ #include #include #include using namespace std; #define SIZE 51 // 50; int W, H;int map[SIZE][SIZE];int visit[SIZE][SIZE];int ans;int a, b;int x, y, nx, ny;int dx[] = { 0,0,1,-1,-1,-1,1,1 };int dy[] = { 1,-1,0,0,-1,1,-1,1 };in..
2018. 3. 8.
백준 1012 유기농 배추
/*1611 유기농 배추1012 번문제입니다.배추를 흰지렁이의 마리 수를 출력하세요. 섬의 갯수를 세는 문제와 동일 합니다.1이 있는 곳에서 갈 수 있는 곳에 비지트 처리를 하고,또 다른 1을 찾아서 비지트 처리를 하고 이런식으로하면서 cnt++ 를 visit 에 넣으면 됩니다. 오께이. */ #include #include using namespace std; #define SIZE 51 // 50; int N, M, K;int map[SIZE][SIZE];int visit[SIZE][SIZE];int ans;int a, b;int x, y, nx, ny;int dx[] = { 0,0,1,-1 };int dy[] = { 1,-1,0,0 };int wormCnt = 1; struct points {int..
2018. 3. 8.