摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1406#include using namespace std;int main(){ int n,m,t; while(cin>>n>>m>>t){ int ans=0; bool check=0; for(int i=0;izz){ zz=(t-n*i)/m*m+i*n; ... 阅读全文
posted @ 2014-02-09 20:27 wonderzy 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=284水题#include #include #include #include #define f first#define s second#define ll long long#define inf 1e17using namespace std;pair p[15];int n,ct;ll dp[15][15];int path[1 阅读全文
posted @ 2014-02-09 20:25 wonderzy 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=52水题#include #include #include #include #define inf 0x3f3f3f3fusing namespace std;int n,m;int a[15][110];int dp[15][110],fuck[110];int DP(int x,int y){ if(dp[x][y]!=inf) re 阅读全文
posted @ 2014-02-09 20:19 wonderzy 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 很水的一道DP#include #include #include using namespace std;int a[1010],l,c,n;int dp[1010],cost[1010];int f(int x){ if(x==0) return 0; else if(x=1;j--){ sum+=a[j]; if(sum>l) break; if(dp[j-1]+11) puts(""); printf("Case %d:\n",cas++); printf(... 阅读全文
posted @ 2014-02-09 20:02 wonderzy 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 我只能说这道题被我做成了蘑菇题。。。#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) 编辑