摘要:        
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)
        
        
                    
                

浙公网安备 33010602011771号