- 最后登录
- 2018-2-23
- 在线时间
- 151 小时
- 阅读权限
- 20
- 注册时间
- 2004-7-23
- 积分
- 1918
- 帖子
- 588
- 精华
- 5
- UID
- 145
- 性别
- 男
- 积分
- 1918
- 帖子
- 588
- 精华
- 5
- UID
- 145
- 性别
- 男
|
又找到一题
level 0
#####
# + ##
##$.$ #
# * #
# * #
## ###
####
level 1
#####
# + #
#$.$#
# * ##
## * #
# * #
# * #
## ###
####
level 2
#####
# + #
#$.$#
# * #
# * #
# * ##
## * #
# * #
# * #
## ###
####
level 7
#####
# + #
#$.$#
# * #
# * #
# * #
# * #
# * #
# * #
# * #
# * #
# * #
# * #
# * #
# * #
# * ##
## * #
# * #
# * #
## ###
####
每一级增加两个箱子,只能是偶数个,奇数个无解
level0="rDrddlLUlldRdrUrruulDuullDDRUdddlUluRurrrddLUruL"
level1="rDDDLUdrrddlLUlldRdrUrruulDuullDDRUdddlUluRurrrddLLUlldRdrUrruulDuuuullDDRUldDDRUdddlUluRurrrddLLUdrruulDlddlUluRuuurrDDLUdrrddLLUlldRdrUrruulDuullDDRUdddlUluRurrrddLUruL"
level2="rDDDLUdrDDLUdrrddlLUlldRdrUrruulDuullDDRUdddlUluRurrrddLLUlldRdrUrruulDuuuullDDRUldDDRUdddlUluRurrrddLLUdrruulDlddlUluRuuurrDDLUdrrddLLUlldRdrUrruulDuullDDRUdddlUluRurrrddLLUlldRdrUrruulDuuuuuullDDRUldDDRUldDDRUdddlUluRurrrddLLUdrruulDlddlUluRuuurrDDLUdrrddLLUlldRdrUrruulDuullDDRUdddlUluRurrrddLLUdrruulDlddlUluRuuuuurrDDLUdrDDLUdrrddLLUlldRdrUrruulDuullDDRUdddlUluRurrrddLLUlldRdrUrruulDuuuullDDRUldDDRUdddlUluRurrrddLLUdrruulDlddlUluRuuurrDDLUdrrddLLUlldRdrUrruulDuullDDRUdddlUluRurrrddLUruL"
box=2X+4=箱子个数
X|box | Total Pushes | Total Moves |
0| 4 | 15 | 48 |
1| 6 | 57 | 170 |
2| 8 | 167 | 494 |
3| 10 | 455 | 1,346 |
4| 12 | 1,209 | 3,580 |
5| 14 | 3,183 | 9,432 |
6| 16 | 8,351 | 24,756 |
7| 18 | 21,881 | 64,878 |
8| 20 | 57,303 | 169,922 |
9| 22 | 150,039 | 444,934 |
10| 24 | 392,825 | 1,164,928 |
11| 26 | 1,028,447 | 3,049,900 |
12| 28 | 2,692,527 | 7,984,824 |
13| 30 | 7,049,145 | 20,904,626 |
14| 32 | 18,454,919 | 54,729,110 |
15| 34 | 48,315,623 | 143,282,762 |
16| 36 | 126,491,961 | 375,119,236 |
17| 38 | 331,160,271 | 982,075,008 |
18| 40 | 866,988,863 | 2,571,105,852 |
19| 42 |2,269,806,329 | 6,731,242,614 |
这个比较象九连环
以下用FOXPRO写了一个解法计算程序(仅对此题),从用到两重循环可知,一定是指数级的。
************
set talk off
clear
maxn=9
DIME sa[10],sb[10],sc[10],sz[10]
*Sc[0]=""
*Sa[0]=""
Sa[1]="DDLUdr"
*Sb0="LUlldRdrUrruulDuullDDRUdddlUluRurrrddL"
Sc[1]="LUdrruulDlddlUluRuuurrDDLUdrrddL"
Sb[1]="LUlldRdrUrruulDuu"+"ll"+"DDRUdddlUluRurrrddL"+ "LUlldRdrUrruulDuu" + "uu" +"ll" +"DDRUld" +"DDRUdddlUluRurrrddL"+ Sc[1]+ "LUlldRdrUrruulDuu"+"ll"+"DDRUdddlUluRurrrddL"
Sz[1]="rD"+Sa[1]+ "rddl" +Sb[1] + "UruL"
for n=2 to maxn
Sa[n]=fm("DDLUdr",n)
Sc[n]="LUdrruulDlddlUluRu" + fm("uu",n) +"rr"+ Sa[n] + "rddL"
Sb[n]=Sb[n-1] +"LUlldRdrUrruulDuu" + fm("uu",n) +"ll" +fm("DDRUld",n) +"DDRUdddlUluRurrrddL"
*Sb[n]=Sb[n] +Sc[1] +Sb[0]
Sb[n]=Sb[n] +Sc[1] +"LUlldRdrUrruulDuullDDRUdddlUluRurrrddL"
FOR j=2 to n
Sb[n]=Sb[n] +Sc[j] +Sb[j-1]
next
Sz[n]="rD"+Sa[n]+ "rddl" +Sb[n] + "UruL"
_cliptext=Sz[n]
?"level","box","move and push"
? n,n*2+4, len(Sz[n])
wait
next
return
func fm(fs,fm)
fss=""
if fm>=1 then
for fi=1 to fm
fss=fss+fs
next
endif
return fss
***********
[ 本帖最后由 jinyou 于 2009-6-15 16:26 编辑 ] |
-
总评分: 经验 + 10
查看全部评分
|