鱼C论坛

 找回密码
 立即注册
查看: 2548|回复: 0

题目220:龙形曲线

[复制链接]
发表于 2017-1-5 15:53:58 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
Heighway Dragon

Let D0 be the two-letter string "Fa". For n≥1, derive Dn from Dn-1 by the string-rewriting rules:

        "a" → "aRbFR"
        "b" → "LFaLb"

Thus, D0 = "Fa", D1 = "FaRbFR", D2 = "FaRbFRRLFaLbFR", and so on.

These strings can be interpreted as instructions to a computer graphics program, with "F" meaning "draw forward one unit", "L" meaning "turn left 90 degrees", "R" meaning "turn right 90 degrees", and "a" and "b" being ignored. The initial position of the computer cursor is (0,0), pointing up towards (0,1).

Then Dn is an exotic drawing known as the Heighway Dragon of order n. For example, D10 is shown below; counting each "F" as one step, the highlighted spot at (18,16) is the position reached after 500 steps.

p220.gif


What is the position of the cursor after 1012 steps in D50 ?
Give your answer in the form x,y with no spaces.


题目:

已知 D0 是两个字母组成的字符串 "Fa",对于任意 n≥1,我们可以依据下面的字符串重写规则,从 Dn-1 推导出 Dn

        "a" → "aRbFR"
        "b" → "LFaLb"

所以,D0 = "Fa", D1 = "FaRbFR", D2 = "FaRbFRRLFaLbFR", 以此类推。

这些字符串可以作为某个计算机图形游戏的指令,"F" 表示“向前一格”, "L" 表示“左转 90 度”, "R" 表示 “右转90度”, "a" 和 "b" 忽略。电脑光标的初始位置是(0,0),指向(0,1)。


Dn 会得到很奇异的一幅图案,称之为 n 阶龙形曲线,比如下面这图就是 D10,每遇到一个 F 就前进一步,500 步后,就到了图中高亮显示的(18,16)这个点了。

p220.gif


请问, 光标在 D50 中走了 1012 步后,它的位置在哪儿?

请以 x,y 的形式给出答案,中间不允许有空格。



想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-12-22 16:16

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表