청소년 상어 C++
https://www.acmicpc.net/problem/19236 19236번: 청소년 상어 첫째 줄부터 4개의 줄에 각 칸의 들어있는 물고기의 정보가 1번 행부터 순서대로 주어진다. 물고기의 정보는 두 정수 ai, bi로 이루어져 있고, ai는 물고기의 번호, bi는 방향을 의미한다. 방향 bi는 www.acmicpc.net #include using namespace std; const int MAX = 5; struct MOVE { int x, y; }; MOVE mv[8] = { { -1,0 },{ -1,-1 },{ 0,-1 },{ 1,-1 },{ 1,0 },{ 1,1 },{ 0,1 }, {-1,1} }; struct INFO { int num, dir; }; INFO map[MAX][MAX];..
2021. 4. 17.
마법사 상어와 파이어볼 C++
https://www.acmicpc.net/problem/20056 20056번: 마법사 상어와 파이어볼 첫째 줄에 N, M, K가 주어진다. 둘째 줄부터 M개의 줄에 파이어볼의 정보가 한 줄에 하나씩 주어진다. 파이어볼의 정보는 다섯 정수 ri, ci, mi, si, di로 이루어져 있다. 서로 다른 두 파이어볼의 위치 www.acmicpc.net #include #include using namespace std; const int MAX = 51; vector map[MAX][MAX]; int n, m, k; struct fireball { int r, c, m, s, d; }; vector fb; struct MOVE { int x, y; }; MOVE mv[8] = { {-1,0}, {-1,1}..
2021. 4. 13.
스타트 택시 C++
https://www.acmicpc.net/problem/19238 19238번: 스타트 택시 첫 줄에 N, M, 그리고 초기 연료의 양이 주어진다. (2 ≤ N ≤ 20, 1 ≤ M ≤ N2, 1 ≤ 초기 연료 ≤ 500,000) 연료는 무한히 많이 담을 수 있기 때문에, 초기 연료의 양을 넘어서 충전될 수도 있다. 다 www.acmicpc.net #include #include #include #include using namespace std; const int MAX = 21; int map[MAX][MAX]; int oil,n,m; pair loc; struct texi { int ci, cj, mi, mj; }; vector pg; struct MOVE { int x, y; }; MOVE mv..
2021. 4. 13.