摘要:        
转自:背包久讲Tianyi Cui初始化的细节问题我们看到的求最优解的背包问题题目中,事实上有两种不太相同的问法。有的题目要求“恰好装满背包”时的最优解,有的题目则并没有要求必须把背包装满。一种区别这两种问法的实现方法是在初始化的时候有所不同。如果是第一种问法,要求恰好装满背包,那么在初始化时除了f...    阅读全文
posted @ 2014-12-02 22:11
立刻行动
阅读(440)
评论(0)
推荐(1)
        
            
        
        
摘要:        
开始学dfs 与bfs 时一直喜欢用vis[][]来标记有没有访问过,现在我觉得没有必要用vis[][]标记了看代码用'#'表示墙,'.'表示道路if(所有情况都满足){ map[i][j]='#'; dfs(i,j); map[i][j]='.';}一般情况都可以这样做。    阅读全文
posted @ 2014-12-02 18:11
立刻行动
阅读(564)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1242水题,bfs代码#include#include#include#includeusing namespace std;int n,m,success;int stx,sty,ex,ey;char m...    阅读全文
posted @ 2014-12-02 18:02
立刻行动
阅读(191)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1241水题,不过这题有一点要注意, (not counting the end-of-line characters) (不包括行尾字符), 这里用%s输入好一些,我开始用%c输入,格式全不对,输入不完...    阅读全文
posted @ 2014-12-02 15:59
立刻行动
阅读(143)
评论(0)
推荐(0)
        
            
        
        
摘要:        
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1181水题一个,bfs ,dfs多可以。bfs时间更优一些,bfs代码#include#include#include#include#includeusing namespace std;int succ...    阅读全文
posted @ 2014-12-02 14:00
立刻行动
阅读(227)
评论(0)
推荐(0)
        
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号