摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1242刚开始由于 没标记已走过的 导致RE TLE 纠结了好久 同样纠结为什么正着搜就WAView Code 1 #include <stdio.h> 2 #include<string.h> 3 int n, m,p = 0,q = 0; 4 char c[201][201]; 5 typedef struct queue 6 { 7 int num, x, y; 8 }st; 9 st Q[100001];10 void inque(int a, int b)11 {12 q++; 阅读全文
posted @ 2012-07-12 23:38 _雨 阅读(179) 评论(0) 推荐(0)
摘要: 看了看题 没什么想法 参考着解题报告写的状态方程 dp[i][j] = max{dp[i+1][j],dp[i+1][j+1],dp[i+1][j-1]}View Code 1 #include <stdio.h> 2 #include<string.h> 3 int dp[100001][12]; 4 int max1(int x, int y, int z) 5 { 6 int m = x; 7 if(m<y) 8 m = y; 9 if(m<z)10 m = z;11 return m;12 }13 int main()14 {15 ... 阅读全文
posted @ 2012-07-12 21:32 _雨 阅读(228) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=1321由于忘记取消起点那里的标记 WA了一次 有点类似皇后View Code 1 #include <stdio.h> 2 #include<string.h> 3 int n, m,count,x[11],y[11]; 4 char c[10][10]; 5 void dfs(int i, int j, int v) 6 { 7 int p,q; 8 if(v == m) 9 count++;10 else11 {12 for(p = i+1 ; p <= n ; p++)13 ... 阅读全文
posted @ 2012-07-12 16:59 _雨 阅读(141) 评论(0) 推荐(0)
摘要: 这题主要是重复问题怎么删除 由于是排好序的 有重复的 肯定是相邻的在同一层上的结点值 保证不相同就行 不同层可以相同 比如 4 = 2+1+1 可以有两个1具体看代码View Code 1 #include <stdio.h> 2 #include<string.h> 3 int a[1001],n,s,v,y,flag,num[1001],ch; 4 void dfs(int x, int i,int v) 5 { 6 int j,k; 7 y+= x; 8 num[v] = x; 9 if(y == s)10 {11 for... 阅读全文
posted @ 2012-07-12 15:37 _雨 阅读(189) 评论(0) 推荐(0)