NOTE/Algorithm27 자료구조) linked_stack #include #include typedef struct _node{ int data; struct _node *link;}_node; typedef struct _stack{ _node *top;}_stack; void init(_stack *s){ s->top = NULL;} int is_empty(_stack *s){ return (s->top == NULL);} void push(_stack *s, int data){ _node *temp; temp = (_node *)malloc(sizeof(_node)); temp->data = data; temp->link = s->top; s->top = temp;} int pop(_stack *s){ int item; if (is_empty(s)) { .. 2015. 8. 25. dovelet) maze 최단 거리 미로 #include #pragma warning(disable:4996) char map[100][100];int visited[100][100];int len = 1000;int n, m; void maze(int x, int y, int min){ map[x][y] = '1'; if (x == 0 && y == m - 1) { if (len > min) len = min; } if (map[x - 1][y] == '0') { maze(x - 1, y, min + 1); } if (map[x + 1][y] == '0') { maze(x + 1, y, min + 1); } if (map[x][y + 1] == '0') { maze(x, y + 1, min + 1); } if (map[x][y - 1] == .. 2015. 8. 25. uva_10074) Take the Land #include using namespace std; int n, m;int map[105][105]; int gg(int a, int b, int count){ if (b > testcase; while (testcase--) { cin >> n >> m; for (int i = 0; i num; if (num == 0) map[i][j] = 1; else map[i][j] = 2; } } int garo; int sero; int mul = 0; int max = 0; for (int i = 0; i 2015. 8. 21. 이전 1 2 3 4 5 다음