사칙연산 C++
https://programmers.co.kr/learn/courses/30/lessons/1843 코딩테스트 연습 - 사칙연산 ["5", "-", "3", "+", "1", "+", "2", "-", "4"] 3 programmers.co.kr #include #include #include #include using namespace std; const int MAX = 205; int dp[MAX][MAX][2]; //0:최솟값, 1:최댓값 void sol(vector arr, int ii, int jj) { for (int k = ii + 1; k < jj; k += 2) { if(dp[ii][k-1][0] == 2e9) sol(arr, ii, k - 1); else if (dp[k + 1][jj..
2022. 3. 22.
블록 게임 C++
https://programmers.co.kr/learn/courses/30/lessons/42894 코딩테스트 연습 - 블록 게임 [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,4,0,0,0],[0,0,0,0,0,4,4,0,0,0],[0,0,0,0,3,0,4,0,0,0],[0,0,0,2,3,0,0,0,5,5],[1,2,2,2,3,3,0,0,0,5],[1,1,1,0,0,0,0,0,0,5]] 2 programmers.co.kr #include #include using namespace std; int answer = 0; int R, C; vector b; bool fl..
2022. 3. 21.
방의 개수 C++
https://programmers.co.kr/learn/courses/30/lessons/49190 코딩테스트 연습 - 방의 개수 [6, 6, 6, 4, 4, 4, 2, 2, 2, 0, 0, 0, 1, 6, 5, 5, 3, 6, 0] 3 programmers.co.kr #include #include #include using namespace std; struct MOVE { int x, y; }; MOVE mv[8] = { {-1,0}, {-1,1}, {0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1} }; map edge; map line; int solution(vector arrows) { int answer = 0; int movei = 0; int movej =..
2022. 3. 21.