摘要: 题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2138 第一个搜索,我也不知道这到底是BFS还是DFS。。。。那个全局标记变量没有初始化,WA了一次。。。本来多么美好的一个开始就这样破坏了。。 1 #include <stdio.h> 2 #include <string.h> 3 int p[1001][1001],o[1001],z; 4 void dfs(int n,int x) 5 { 6 int i; 7 o[x] = 1; 8 if(x == 1 阅读全文
posted @ 2012-05-28 21:38 Naix_x 阅读(203) 评论(0) 推荐(0)
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1435这个题做的好没状态。上几天刷的高精度都白刷了啊。。。首先代码除法和取余以前都做过,还要查看以前的代码,模板还打错。。DEBUG好久,然后由于这个破精度(还是看的队友的解题报告),错了好几次,开始数组RE一一次,忘记0的情况(高精度老问题),还要有那个破空格,终于6A。。。基本上这个题所有的trick我都踩了。 1 #include <stdio.h> 2 阅读全文
posted @ 2012-05-28 20:02 Naix_x 阅读(402) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2137 后序遍历没啥好说的,递归就好,层次遍历有点BFS的感觉。 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 struct tree 5 { 6 char l; 7 struct tree *left,*right; 8 }; 9 struct tree *build(char *p,char *s,int n 阅读全文
posted @ 2012-05-28 19:07 Naix_x 阅读(204) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2136 这个题看书+问学长.2A.#include <stdio.h>#include <string.h>#include <stdlib.h>int num=-1;char str[51];struct tree{ char lat; struct tree *left; struct tree *right;};struct tree *build()//建树{ struct tree *p; 阅读全文
posted @ 2012-05-28 16:53 Naix_x 阅读(208) 评论(0) 推荐(0)