题目220:龙形曲线
Heighway DragonLet 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.
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)这个点了。
请问, 光标在 D50 中走了 1012 步后,它的位置在哪儿?
请以 x,y 的形式给出答案,中间不允许有空格。
页:
[1]