摘要: 从S出发,E点逃出,只能走.用队列的方法三维数组#include #include #include #include using namespace std; #define N 110 int dir[6][3] = {{0,0,1},{0,0,-1},{0,1,0},{0,-1,0},{1,0,0},{-1,0,0}}; char a[N][N][N]; int l,r,c; int x1... 阅读全文
posted @ 2016-07-29 10:28 biu~biu~biu~ 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 一个三角形矩阵,给一个n,n行n列,当i==j的时候不显示,A(i,j)代表i到j的路程,最后求1到1...n的最短路的最大值。这道题n的数据范围是100,所以可以用Floyd算法-----------------------------------------------------------------------------------------#include #include ... 阅读全文
posted @ 2016-07-25 14:23 biu~biu~biu~ 阅读(105) 评论(0) 推荐(0) 编辑
摘要: bellman算法John的农场里field块地,path条路连接两块地,hole个虫洞,虫洞是一条单向路,不但会把你传送到目的地,而且时间会倒退Ts。我们的任务是知道会不会在从某块地出发后又回来,看到了离开之前的自己。-------------------------------------------------------------------- #include #include ... 阅读全文
posted @ 2016-07-22 15:34 biu~biu~biu~ 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 给定一个牛A,所有牛都要去牛A那里参加活动,参加完后动后返回,所有的路是单向的。 ------------------------------------------------------------------------------ #include #include #include #include #include using namespace std; const int ... 阅读全文
posted @ 2016-07-22 15:30 biu~biu~biu~ 阅读(123) 评论(0) 推荐(0) 编辑
摘要: dij算法,问1到N的最短路 #include #include #include #include #include #include using namespace std; const int maxn = 4005; const int oo = 1e9; int Map[maxn][maxn]; void Init(int n) { for(int i=1;... 阅读全文
posted @ 2016-07-22 15:22 biu~biu~biu~ 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3660给一个M,N,N代表有几头牛,M代表有几组比赛,最后求有几头牛可以确定名次。 -------------------------------------------------------------------- #include #include #include #include #include #defin... 阅读全文
posted @ 2016-07-22 15:19 biu~biu~biu~ 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 从一个点a走到另一个点b,中间可以经过x+1,x-1,x*2,最少几步可以到达b点 阅读全文
posted @ 2016-07-19 09:00 biu~biu~biu~ 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 阅读全文
posted @ 2016-07-19 08:55 biu~biu~biu~ 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 给定两个数a,b,每次只能变动a的其中一个数,变成的数也必须是素数,问最少经过几次可以变成b; 阅读全文
posted @ 2016-07-19 08:48 biu~biu~biu~ 阅读(176) 评论(0) 推荐(0) 编辑