你厉害吗,来过5关试试?(挑战你的智商!)
http://www.sostart.com/article/view.php/765
每个优秀通过sql语句来计算最终得完成路径
比如第四关的一种解法
规则:
在一个棋盘中棋子的路线同象棋中的马,走"日字"
目标:
从任意一个点起跳,经过每个格子一次,最终能够回到源点。
棋盘坐标:
原理:
通过递归,在15步之后(一共14个格子,起始点经过2次)回到起始点
算法:
--第四关:跳马declare @t table(p varchar(max),x int,y int)insert into @t select 'p11',1,1 union select 'p12',1,2 union select 'p13',1,3 union select 'p14',1,4 union select 'p21',2,1 union select 'p22',2,2 union select 'p23',2,3 union select 'p24',2,4 union select 'p31',3,1 union select 'p32',3,2 union select 'p33',3,3 union select 'p34',3,4 union select 'p42',4,2 union select 'p43',4,3 ;with t(pstart,p,c,x,y) as( select p,p,1,x,y from @t union all select t.pstart,t.p+'->'+t_next.p,c+1,t_next.x,t_next.y from @t t_next,t where ( (abs(t_next.x-t.x)=1 and abs(t_next.y-t.y)=2) or (abs(t_next.x-t.x)=2 and abs(t_next.y-t.y)=1) ) and (CHARINDEX(t_next.p,t.p)=0 or (c=14 and t_next.p=t.pstart)))select p from t where c=15
我也試試~~·
[解决办法]
[解决办法]
.....飘过。。。。。
[解决办法]
嗨~~
[解决办法]
看看,MS挺有意思的,不过估计还得用程序的思想做。。。。
[解决办法]
[解决办法]
留个记号。。。。。。。。。。。。。。。。。。。。
[解决办法]
很好..来学习..呵呵
[解决办法]
路过。。。。。。。。
[解决办法]
[解决办法]
回去试试!!
[解决办法]
mark
[解决办法]
[解决办法]
围观。
[解决办法]
have a look
[解决办法]
不是很明白的,研究研究
[解决办法]
不明白,有时间了研究研究
[解决办法]
我就是来看看 厉害的人!!!
[解决办法]
........................................
[解决办法]
Can you do it less than 9 moves?
[解决办法]
全部通过..........