摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1545#include #include #include #include #include #define ll long longusing namespace std;int change[12][12];ll w[12][12],dp[11][11][11][11][11][11];bool vis[12];int a[12];v 阅读全文
posted @ 2014-02-09 20:57 wonderzy 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1059此题的状态即为4个栈的顶部元素的位置#include #include #include #include #include #include #define ll long longusing namespace std;stack st[5];vector v[5];int n,num;ll dp[42][42][42][42]; 阅读全文
posted @ 2014-02-09 20:55 wonderzy 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1629水题记忆化dp#include #include #include #define ll long longusing namespace std;int t,n,k;ll a[1010];ll dp[1100][1100];ll DP(int x,int y){ if(x+1==y) return 2*min(a[x],a[y]); 阅读全文
posted @ 2014-02-09 20:51 wonderzy 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1567此题状态即为各种硬币个数,然后分类讨论即可。#include #include #include using namespace std;int t;int num, n[3], dp[705][220][100], vis[705][220][100];int dfs(int num, int n1, int n2, int n3) 阅读全文
posted @ 2014-02-09 20:50 wonderzy 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1853#include #include #include using namespace std;int l,s;int dp[30][400][30];int DP(int x,int y,int z){ if(dp[x][y][z]!=-1) return dp[x][y][z]; if(x!=0&&y==0) ret 阅读全文
posted @ 2014-02-09 20:49 wonderzy 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1342#include #include #include #define ll long longusing namespace std;char s[50];ll dp[50][50];int f(int x){return x>=0 ? x:(-x);}int to(char s){ if(s>='0'&a 阅读全文
posted @ 2014-02-09 20:48 wonderzy 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=643#include #include #define ll long longusing namespace std;int n,m;ll dp[30][30][2],ans;bool vis[30];ll DP(int l,int v,int c){ if(dp[l][v][c]!=-1) return dp[l][v][c]; if( 阅读全文
posted @ 2014-02-09 20:47 wonderzy 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1662#include #define ll long longusing namespace std;int n,k,m;ll dp[52][52][52][52][2];void gao(){ dp[1][1][1][1][0]=0,dp[1][1][1][1][1]=1; for(int i=2;i>n>>k> 阅读全文
posted @ 2014-02-09 20:45 wonderzy 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1558#include #include #include #define ll long longusing namespace std;int t,l;ll dp[65][65];char s[100];ll DP(int x,int y){ if(dp[x][y]!=-1) return dp[x][y]; if(x>y) re 阅读全文
posted @ 2014-02-09 20:43 wonderzy 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1245#include #include #define ll long longusing namespace std;ll v[300],sum[300];ll dp[300][300];int n;ll DP(int x,int y){ if(dp[x][y]!=(ll)1e17) return dp[x][y]; if(x==y) 阅读全文
posted @ 2014-02-09 20:42 wonderzy 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=531#include #include #define ll long longusing namespace std;int n,t;ll dp[1010][12],a[12][12][33];int c[12][12];int main(){ //freopen("590","r",stdin); 阅读全文
posted @ 2014-02-09 20:41 wonderzy 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1884#include #include #define mod 1000000using namespace std;int dp[110][110];int DP(int x,int y){ if(dp[x][y]!=-1) return dp[x][y]; if(y==1) return dp[x][y]=1; int ret=0; 阅读全文
posted @ 2014-02-09 20:39 wonderzy 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=652#include #include #include using namespace std;int c[7],sum,sumw;bool in(){ sum=0,sumw=0; for(int i=1;i>c[i],sum+=c[i],sumw+=i*c[i]; for(int i=1;i=0;j--){ for(int... 阅读全文
posted @ 2014-02-09 20:38 wonderzy 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1010#include #include #include #include #include #include #define maxn 10000using namespace std;void reverse(string &ans,int ct){ for(int i=0;i=0&&d[i]==0) i--; 阅读全文
posted @ 2014-02-09 20:37 wonderzy 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1022#include #include #include #include #define eps 1e-9using namespace std;int n,k;double dp[110][10];double f(double x){ return x>-eps ? x:(-x);}int main(){ while(cin& 阅读全文
posted @ 2014-02-09 20:35 wonderzy 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1341注意除以0和溢出的情况#include #include #include using namespace std;int dp[110][64000];int a[110],n,x,k,ans[110];int main(){ int t; cin>>t; while(t--){ cin>>n; for(in 阅读全文
posted @ 2014-02-09 20:33 wonderzy 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=1226#include #include #include using namespace std;string ren;int n,m,t;int a[110][110],dp[110][110];int d[4][2]={-1,0,0,1,1,0,0,-1};int DP(int x,int y,int l){ if(dp[x][y]! 阅读全文
posted @ 2014-02-09 20:30 wonderzy 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题目链接: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) 编辑