摘要: 我只能说这道题被我做成了蘑菇题。。。#include #include #include #include #include #include #include #define ll long longusing namespace std;struct cell{ string str; int value;}c[35];int t,N,K;int dp[35][35][18];int path[35][35],sum[35];vector v;int high,low,ans;void init(){ memset(dp,-1,sizeof dp); v.clear... 阅读全文
posted @ 2014-02-08 17:11 wonderzy 阅读(188) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;char s[1010];int dp[1010][1010],l;string str[1010][1010];int DP(int x,int y){ if(x>y) return 0; if(dp[x][y]!=-1) return dp[x][y]; int ret=1; char Min=s[x]; for(int i=x+1;ii;j--){ if(s[i]==s[j]){ ans+=s[i... 阅读全文
posted @ 2014-02-08 17:07 wonderzy 阅读(157) 评论(0) 推荐(0) 编辑
摘要: if(s[x]==s[y]) dp[x][y]=dp[x+1][y-1]+2else dp[x][y]=min(dp[x+1][y],dp[x][y-1])+2方案分开来求#include #include #include #include #include using namespace std;char s[1010];int dp[1010][1010];int x,y,ac,l;string ans;int DP(){ if(dp[x][y]!=-1) return dp[x][y]; if(x>y) return dp[x][y]=0; if(x==y) retu... 阅读全文
posted @ 2014-02-08 17:02 wonderzy 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 此题的状态是当前用了那些,和四个位置各自的颜色。#include #include #include using namespace std;int t;char block[14][4];bool vis[14];int belong[14],dp[1<<12+2][5][5][5][5];int to(char c){ if(c=='Z') return 0; else if(c=='R') return 1; else if(c=='G') return 2; else if(c=='B') return 3; 阅读全文
posted @ 2014-02-08 16:55 wonderzy 阅读(215) 评论(0) 推荐(0) 编辑
摘要: dp[l][x][used]表示长度为l尾部为x的串用了那些数字的种数#include #include #include #define mod 1000000007using namespace std;int t,n,m;int dp[110][12][1=0 ? x:(-x);}int DP(int l,int x,int used){ if(l==0){ if(used==(1<<n)-1) return 1; else return 0; } if(dp[l][x][used]!=-1) return dp[l][x][used]; ... 阅读全文
posted @ 2014-02-08 16:49 wonderzy 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 首先那括号里的一坨是所有数的小数部分相加取下整dp[x][y]表示前x个组成和为y的个数#include #include #include #define eps 1e-9#define ll long longusing namespace std;int n;double v[110];ll dp[10][110];/*ll DP(int x,int value){ if(x==0) return value==0; if(dp[x][value]!=-1) return dp[x][value]; ll ret=0; for(int i=0;i=int(v[i]... 阅读全文
posted @ 2014-02-08 16:42 wonderzy 阅读(174) 评论(0) 推荐(0) 编辑
摘要: dp[x]表示1-x的划分最大和,最多从前面10个位置转移过来#include #include #include #include #include #define ll long long#define MAX_INT 2147483647using namespace std;int n,l;string s;ll dp[210],num[210][210];ll DP(int x){ if(x<=9&&num[0][x]<=MAX_INT) return num[0][x]; if(dp[x]!=-1) return dp[x]; ll ret=0; for 阅读全文
posted @ 2014-02-08 16:37 wonderzy 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 用dp[x][y]表示以(x,y)点为右下角,所形成的图形的最大边长#include #include #include using namespace std;int n;char s[502][502];int dp1[502][502],dp2[502][502];int DP1(int x,int y){ if(s[x][y]=='.') return 0; if(x==0||y==0) return s[x][y]=='x' ? 1:0; if(dp1[x][y]!=-1) return dp1[x][y]; int ret=1000; ret=min 阅读全文
posted @ 2014-02-08 16:26 wonderzy 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 该题的难点在于费用的计算,需考虑未来能转移到的所有状态用dp[l][r][next]表示l到r之间以及r之后与r同色的所有next个方块的最大费用和#include #include #include using namespace std;int t,n,a[202],k,cnt;int dp[202][202][202];struct block{ int x,c; block(){} block(int x,int c):x(x),c(c){}}b[202];void init(){ k=1,cnt=1; for(int i=1;i=r) return ne... 阅读全文
posted @ 2014-02-08 16:21 wonderzy 阅读(234) 评论(0) 推荐(0) 编辑