摘要: #include<stdio.h> #include<iostream> using namespace std; #include<stdlib.h> int visit[30];//visit为标记数组 int a[30]; int n; int count; /*判断是否为素数*/ int s 阅读全文
posted @ 2016-03-24 21:21 请叫我凯凯大人 阅读(214) 评论(0) 推荐(0)
摘要: #include #include using namespace std; #include int visit[30];//visit为标记数组 int a[30]; int n; int count; /*判断是否为素数*/ int su(int x) { int i; for(i=2; i*i<=x; i++) if(x%i==0) ... 阅读全文
posted @ 2016-03-24 21:18 请叫我凯凯大人 阅读(283) 评论(0) 推荐(0)
摘要: #include #include int visit[5][5]; int a[5][5];//记录所存储的的第几步的数值,例如在a[2][2]是第三步,a[2][2]=3; //应该是八个方向,自己可以画图看,相对于自己的位置横纵坐标相差多少 int X[8]= {2,-1,1,-2,2,1,-1,-2}; int Y[8]= {1,2,2,1,-1,-2,-2,-1}; int count... 阅读全文
posted @ 2016-03-24 21:17 请叫我凯凯大人 阅读(459) 评论(0) 推荐(0)
摘要: 仿照前面广度优先遍历做得,纯手改,初窥门径 阅读全文
posted @ 2016-03-24 19:29 请叫我凯凯大人 阅读(1216) 评论(0) 推荐(0)
摘要: 老是用二维数组,需要很高的技巧,但是遇到复杂的题,在用二维数组会很麻烦,运用数据结构会感觉很清晰,问题不会那么复杂 阅读全文
posted @ 2016-03-24 16:26 请叫我凯凯大人 阅读(1757) 评论(0) 推荐(0)