动规
_sophon
Brooding renders me prophetic
展开
-
Luogu P1002 过河卒
原题传送门 #include <bits/stdc++.h> using namespace std; int xend,yend,xbeg,ybeg; int walk[17][17]={0}; int mp[17][17]={0}; int movex[]={0,-1,0,1}; int movey[]={-1,0,1,0}; bool flag=false; string co...原创 2019-02-09 20:10:25 · 163 阅读 · 0 评论 -
Luogu P1282 多米诺骨牌
原题传送门 #include <bits/stdc++.h> using namespace std; const int N = 1004; const int INF = 0x7f7f7f7f; int fewest_time[N][6 * N];//[i][j]=[前i个][up和为j]最少交换次数 int up[N], down[N];//上下层数组 int main() ...原创 2019-02-21 16:14:43 · 62 阅读 · 0 评论 -
Luogu P1164 小A点菜
原题传送门 #include <bits/stdc++.h> using namespace std; int ans[105][10005];//ans[i][j]表示在第i道菜之前花完j元的方法数,在main外已初始化为0 int price[105];//价格 int main() { int n, m; cin >> n >> m; for ...原创 2019-02-17 19:31:22 · 309 阅读 · 0 评论 -
Luogu P1958 上学路线
原题传送门 DP #include &lt;iostream&gt; int a, b; using namespace std; int map[20][20]; int gap[20][20]; int main() { cin &gt;&gt; a &gt;&gt; b; int inx, iny; int t; cin &gt原创 2019-02-11 20:37:31 · 235 阅读 · 0 评论 -
Luogu P1387 最大正方形
原题传送门 #include <bits/stdc++.h> using namespace std; int mp[105][105]; int ans[105][105]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j =...原创 2019-02-23 09:45:49 · 102 阅读 · 0 评论 -
Luogu P1004 方格取数
原题传送门 #include <bits/stdc++.h> using namespace std; int mp[15][15]; int f[15][15][15][15];//将走到目的地回头转化为两个人从起点开始走,f[i][j][k][l]表示两人走到(i,j)和(k,l)时的最大值 int Max(int a, int b, int c, int d)//取最大值函数...原创 2019-02-28 19:04:12 · 105 阅读 · 0 评论 -
Luogu P1006 传纸条
原题传送门 #include <bits/stdc++.h> const int M = 55; using namespace std; int f[M * 2][M][M]; int a[M][M]; int Max(int a, int b, int c, int d) { int t[4]; t[0] = a; t[1] = b; t[2] = c; t[3] =...原创 2019-02-25 15:04:45 · 70 阅读 · 0 评论 -
Luogu P1216 [IOI1994][USACO1.5]数字三角形 Number Triangles
原题传送门 #include <bits/stdc++.h> using namespace std; int f[1005][1005];//f[i][j]是走到i行j列时最大值 int main() { int row;//行数 cin >> row; int in; for (int i = 1; i <= row; i++) { for (...原创 2019-02-20 15:43:51 · 184 阅读 · 0 评论 -
Luogu P1091 合唱队形
原题传送门 #include <bits/stdc++.h> using namespace std; int n; int a[105];//身高序列 int head_to_tail[105];//方向从头到尾,到第i个为止,包含第i个在内,a[]的最长上升子序列(非连续)的长度 int tail_to_head[105];//方向从尾到头,到第i个为止,包含第i个在内,a[]的...原创 2019-02-21 11:11:17 · 110 阅读 · 0 评论