摘要: http://poj.org/problem?id=2632唉。。做模拟题一定要细心啊。才开始自己吧题意读错了,以为向左右转后还要走呢。调了很长时间还是没有过样例,最后又看了一遍题目才发现,原来是原地打转。悲剧啊。还有就是对于tagp[a].mark的判断,if 必须配有els否则上一步对mark的改变会影响到下一步的处理。唉。。。这样的小错误在模拟题中是很难检查的。。唉。。费劲啊。View Code #include <iostream>#include <cstdio>#include <cstring>#define maxn 10007using n 阅读全文
posted @ 2012-02-25 22:08 E_star 阅读(319) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=1068给你一系列的左右括号的两个表示方法,p和W.然后是有P向W转换Pi表示第i个右括号前边有几个左括号;Wi表示第i个右括号如果要找匹配的话,要找从后往前数几个左括号与它匹配。View Code #include <iostream>#include <cstdio>#include <cstring>#define maxn 25using namespace std;int fb[maxn],fw[maxn];//存储两种匹配int ct[maxn],len[maxn];//记录长度,ct变而len 阅读全文
posted @ 2012-02-25 20:07 E_star 阅读(260) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=3295首先分别将p,q,r,s,t的值饭分别枚举出来,然后运用递归将问题不到缩小,并判断是否为永真式。View Code #include <iostream>#include <cstdio>#include <cstring>#define maxn 107using namespace std;char str[maxn];int flag[10];int start;int juage(){ int p,q; switch(str[++start]) { case 'K': p = 阅读全文
posted @ 2012-02-25 19:29 E_star 阅读(255) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2506这道题和原来课本上的一个递推题相似,不过这里有了两种选择,2*2 和2*1f[n] = f[n-1] + f[n-2]*2 ;View Code #include <iostream>#include <cstdio>#include <cstring>#define maxn 1007using namespace std;int f[255][maxn];int tmp[maxn];//记录f[n-2]*2后的结果int len[maxn];//记录每个数的长度void muilty(int * 阅读全文
posted @ 2012-02-25 16:06 E_star 阅读(339) 评论(0) 推荐(0)