BOJ

알고리즘 문제 풀이/1DP_과제(~180615)

180125_10835_카드게임

//https://www.acmicpc.net/problem/10835#include #include #include #include using namespace std;int dp[2001][2001]; // dp[x][y] : 왼쪽카드x번째, 오른쪽카드 y번째일 때, 앞으로 얻을 수 있는 점수 최대값int lc[2001]; // left cardint rc[2001]; // right cardint n; int play(int x, int y){ if(x==n+1 || y==n+1) return 0;// 둘 중 하나가 더이상 카드가 없으면 앞으로 얻을 점수 0 if(dp[x][y] != -1) return dp[x][y]; // 이미 계산한 것은 나와야함 // 앞으로 얻을 점수이므로 앞에서와는 무관하..

알고리즘 문제 풀이/1DP_과제(~180615)

180124_10942_팰린드롬?

//https://www.acmicpc.net/problem/10942#include #include using namespace std;int num[2001];bool dp[2001][2001]; int main() { int n, m; int start, end; scanf("%d",&n); for(int i=1; i

알고리즘 문제 풀이/1DP_과제(~180615)

180123_1937_욕심쟁이 판다

//https://www.acmicpc.net/problem/1937 #include #include #include using namespace std;int map[502][502];int dp[502][502];int dy[4] = {1,0,-1,0};int dx[4] = {0,1,0,-1}; int n;int mov(int nowy, int nowx){ if(dp[nowy][nowx]==0) { dp[nowy][nowx]=1; int nexty, nextx; for(int i=0; imap[nowy][nowx]) { dp[nowy][nowx]=max(dp[nowy][nowx],mov(nexty,nextx)+1); } } } return dp[nowy][nowx];} int main(){ scanf..

알고리즘 문제 풀이/1DP_과제(~180615)

180123_11057_오르막수

//https://www.acmicpc.net/problem/11057#include using namespace std;int dp[10][1001]; int main(){ int n, sum; cin >> n; if(n==1) { cout

bong sue
'BOJ' 태그의 글 목록 (16 Page)