谁能帮我翻译一下这个简单的问题,只要3分钟就好…… ( 积分: 50 )

C

cjwdone

Unregistered / Unconfirmed
GUEST, unregistred user!
Problem J5: Fractals
A fractal is a geometric shape where the pattern of the whole shape is self-replicating at
each subsection of the shape. A simple “block fractal” is shown below. At each stage of
the fractal growth, every straight line in the fractal is divided into three equal parts. The
first and last sections stay straight;
the middle section contains a square “bump” which
has the same height as the width of the middle section. (You will want to consider the
four orientations of a line segment within the fractal. Depending upon which line segment
is currently being generated, the bump may protrude up,do
wn, left, or right.)
Suppose this fractal is drawn on a Cartesian plane, where (0, 0) is at the bottom left
corner. Assume that in the example above, the bottom left point of the fractal is at (0, 1)
and the bottom right point of the fractal is at (27, 1). For example the top of the Level 3
fractal is a line from (13, 14) to (14, 14).
Write a program that will keep track of the integer coordinate points of the lines in a
similar “block fractal” with its bottom left corner at (0, 1). The program will accept three
integers as input: the level of the fractal, the width of the fractal, and an x-coordinate.
You may assume that the width of the fractal will be some power of three, and that it will
be large enough so that every corner of the fractal will fall on an integer intersection in
the Cartesian plane. The width will never be more
than 81. The x-coordinate, x, will be in the range 0 – width (inclusive). Your program
should output the y-coordinate value(s), y, where lines of the fractal intersect the point (x,
y).
You may draw a graphic representation of the fractal for debugging (and interest).
However, test cases may ask you to define fractals that are too large to fit on a single
screen.

Sample Input 1 ISample Output 1
3 27 5 4 5 6
Sample Input 2 ISample Output 2
3 27 18 1 2 3 4 7 8 9 10
Sample Input 3 ISample Output 3
2 27 19 1 4 7
Sample Input 4 ISample Output 4
4 81 38 37 38 39
还有一张图,这里好像不让上传图片,请联我的msn:huangailian123@hotmail.com
顺便交个朋友……
 

无欲则刚

Unregistered / Unconfirmed
GUEST, unregistred user!
这是个碎片绘制的原理吧
对照词霸不难看懂的
 
C

cjwdone

Unregistered / Unconfirmed
GUEST, unregistred user!
to 无欲:
就是因为对照读霸没看懂所以才发到这里来的,解决问题的程序就不用了,关键是把图形是怎么出来的说清楚,还有就是为什么会有重复。
上面忘了说了,50分不是因为这一道题而给的,这道题只有25分,还有一道题,纯粹的图片,我能不上来,和我的msn联系,如果谁能把两道题都解决,除了50分,我在追加20分,以示奖励。
 

Similar threads

I
回复
0
查看
2K
import
I
I
回复
0
查看
550
import
I
I
回复
0
查看
2K
import
I
I
回复
0
查看
2K
import
I
I
回复
0
查看
1K
import
I
顶部