'알고리즘' 태그의 글 목록 (32 Page)
뱀
www.acmicpc.net/problem/3190 3190번: 뱀 'Dummy' 라는 도스게임이 있다. 이 게임에는 뱀이 나와서 기어다니는데, 사과를 먹으면 뱀 길이가 늘어난다. 뱀이 이리저리 기어다니다가 벽 또는 자기자신의 몸과 부딪히면 게임이 끝난다. 게임 www.acmicpc.net #include #include #include #include #include using namespace std; #define NS 101//배열의 최대 크기 int N, K, L;//배열크기, 사과 개수, 경로개수 int ret;//결과값 int map[NS][NS];//뱀의 경로 배열 int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; void init_input() {/..
2020. 10. 13.
드래곤 커브
www.acmicpc.net/problem/15685 15685번: 드래곤 커브 첫째 줄에 드래곤 커브의 개수 N(1 ≤ N ≤ 20)이 주어진다. 둘째 줄부터 N개의 줄에는 드래곤 커브의 정보가 주어진다. 드래곤 커브의 정보는 네 정수 x, y, d, g로 이루어져 있다. x와 y는 드래곤 커� www.acmicpc.net #include #include #include #include using namespace std; #define NS 101//배열 최대 크기 int N;//배열의 크기 int ret;//결과 값 int map[NS][NS];//드래곤 커브 확인 배열 int dy[] = { 0,-1,0,1 }; int dx[] = { 1,0,-1,0 }; struct Data { int y, x..
2020. 10. 13.