2012年4月27日

hdu 3779

摘要: 简单记忆化搜索View Code #include<stdio.h>#include<string.h>int as[1005],bs[1005],cs[2005],ok,n,m;char hash[1005][1005];void dfs(int x,int y,int z){ if(hash[x][y]||ok)return; if(z==n+m)ok = 1; hash[x][y] = 1; if(as[x]==cs[z]&&x<n)dfs(x+1,y,z+1); if(ok)return; if(bs[y]==cs[z]&& 阅读全文

posted @ 2012-04-27 16:19 aigoruan 阅读(141) 评论(0) 推荐(0)

hdu 1978

摘要: 记忆化搜索View Code #include<stdio.h>#include<string.h>int n,m;int as[105][105],hash[105][105];int dfs(int x,int y){ int i,j; if(x==n||y==m)return 0; if(hash[x][y]) return hash[x][y]; for(i = 0; i <= as[x][y]; ++ i) for(j = 0; j <= as[x][y]; ++ j) if((i+j)&&(i+x<n)&&( 阅读全文

posted @ 2012-04-27 16:02 aigoruan 阅读(207) 评论(0) 推荐(0)

hdu 1428

摘要: 记忆化搜索View Code #include<stdio.h>#include<string.h>#include<iostream>#include<queue>using namespace std;struct nd{ int x,y;};const long long inf = 0xfffffff;long long as[100][100],hash[100][100],dp[100][100];long long dx[] = {1,-1,0,0};long long dy[] = {0,0,1,-1};long long n;v 阅读全文

posted @ 2012-04-27 16:01 aigoruan 阅读(169) 评论(0) 推荐(0)

导航