上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 47 下一页

2012年6月7日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2625随便写出一个dfs然后猥琐随机化法剪枝,第一次AC的战绩是1/18,还跑了700+ms,随机50w次成功率还这么低。。。最近rp真是太烂了有木有。。。View Code #include <iostream>#include <cstdlib>#include <ctime>using namespace std ;int map[30][30] ;int n ;int ans ;int vis[30] ;void dfs(int d){ if(d==n) { int 阅读全文
posted @ 2012-06-07 10:12 LegendaryAC 阅读(281) 评论(0) 推荐(0) 编辑

2012年6月6日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1865大数的斐波那契数列,又用java猥琐过了。。。View Code import java.io.* ;import java.math.* ;import java.util.* ;import java.text.* ;public class Main{ public static void main(String[]args) { Scanner cin=new Scanner(new BufferedInputStream(System.in)) ; Bi... 阅读全文
posted @ 2012-06-06 22:53 LegendaryAC 阅读(166) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2209艰难的一题,对回溯法的理解又深刻了View Code #include <iostream>using namespace std ;int q[25] ;int cnt[25] ;int len ;int ans ;bool gao(){ for(int i=0;i<len;i++) if(q[i]) return false ; return true ;}void dfs(int idx){ if(gao()) { int ... 阅读全文
posted @ 2012-06-06 20:27 LegendaryAC 阅读(447) 评论(2) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1495bfs,个人感觉很经典的题目,分六种情况搜索View Code #include <iostream>using namespace std ;int s,n,m ;int q[101*101*101][3] ;int dp[101][101][101] ;int bfs(){ if(s&1) return 0 ; if(n<(s>>1)) return 0 ; dp[s][0][0]=0 ; int front=0,rear=1 ; q[fro... 阅读全文
posted @ 2012-06-06 11:07 LegendaryAC 阅读(691) 评论(0) 推荐(0) 编辑

2012年6月5日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1010奇偶剪枝,说好的里程碑来了。。。跳出dfs的时候一定要注意确保跳出。。。我开始写的时候没有跳出dfs只是跳出了一层递归,导致长时间tle,orz涂涂能看出这种问题。View Code #include <iostream>#include <queue>using namespace std ;int n,m,t ;int flag ;int e ;char map[10][10] ;void dfs(int x,int y,int time){ int tab[][2]={1, 阅读全文
posted @ 2012-06-05 17:18 LegendaryAC 阅读(174) 评论(0) 推荐(0) 编辑

2012年6月4日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1035搜搜搜View Code #include <iostream>using namespace std ;char map[11][11] ;int dp[11][11] ;int n,m ;int ans,loop ;int flag ;void dfs(int x,int y,int cnt){ if(x<0 || x>=n || y<0 || y>=m) { flag=0 ; ans=cnt ; return ; } if(dp[x... 阅读全文
posted @ 2012-06-04 23:30 LegendaryAC 阅读(186) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1312从这老题开始吧View Code #include <iostream>#include <queue>using namespace std ;char map[25][25];int ans,n,m;typedef struct L{ int x,y;}L;void bfs(int x,int y){ queue <L> q ; int tab[][2]={1,0,-1,0,0,1,0,-1}; L point,go,front; point.x=x; point 阅读全文
posted @ 2012-06-04 18:29 LegendaryAC 阅读(160) 评论(0) 推荐(0) 编辑
 
摘要: 本菜狗决定好好练搜索了,发现不练好搜索学什么都不安心,用现在的付出补寒假欠的帐吧。 阅读全文
posted @ 2012-06-04 17:25 LegendaryAC 阅读(123) 评论(0) 推荐(0) 编辑

2012年6月3日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1039做一道水题收拾收拾睡了。今天hut校赛被虐成狗哇哈哈哈,被人虐好爽,各种高潮。暑假前要复习期末考试,还有字符串,搜索,计算几何,线段树这么一大堆东西要弄,真是令人充满干劲啊,burning!View Code #include <stdio.h>#include <string.h>int main (){ char str[101]; char tab[5]={'a','e','i','o','u' 阅读全文
posted @ 2012-06-03 22:45 LegendaryAC 阅读(158) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1403学后缀树组罗大牛的《后缀树组——处理字符串的有力工具》应该谁都会看。。不过下面推荐的这个讲解也很不错http://wenku.baidu.com/view/3fd0138884868762caaed5ac.h... 阅读全文
posted @ 2012-06-03 01:46 LegendaryAC 阅读(674) 评论(0) 推荐(0) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 47 下一页