• 欢迎访问废江's博客 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏本站吧

Koch Curve

AOJ 站点默认 10个月前 (04-11) 384次浏览 已收录 11个评论
文章目录[隐藏]

Question

Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.

The Koch curve is well known as a kind of fractals.

You can draw a Koch curve in the following algorithm:

Divide a given segment (p1, p2) into three equal segments.
Replace the middle segment by the two sides of an equilateral triangle (s, u, t) of the same length as the segment.
Repeat this procedure recursively for new segments (p1, s), (s, u), (u, t), (t, p2).
NaMD6.png
You should start (0, 0), (100, 0) as the first segment.

Input
An integer n is given.

Output
Print each point (x, y) of the Koch curve. Print a point in a line. You should start the point(0, 0), which is the endpoint of the first segment and end with the point (100, 0), the other endpoint so that you can draw the Koch curve as an unbroken line. Each solution should be given as a decimal with an arbitrary number of fractional digits, and with an absolute error of at most 10-4.

Constraints
0 ≤ n ≤ 6
Sample Input 1
1
Sample Output 1
0.00000000 0.00000000
33.33333333 0.00000000
50.00000000 28.86751346
66.66666667 0.00000000
100.00000000 0.00000000
Sample Input 2
2
Sample Output 2
0.00000000 0.00000000
11.11111111 0.00000000
16.66666667 9.62250449
22.22222222 0.00000000
33.33333333 0.00000000
38.88888889 9.62250449
33.33333333 19.24500897
44.44444444 19.24500897
50.00000000 28.86751346
55.55555556 19.24500897
66.66666667 19.24500897
61.11111111 9.62250449
66.66666667 0.00000000
77.77777778 0.00000000
83.33333333 9.62250449
88.88888889 0.00000000
100.00000000 0.00000000

Meaning

Sloution

Coding

Summary


个人博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Koch Curve
喜欢 (0)
[]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到
(11)个小伙伴在吐槽
  1. I like and follow your site, thanks
    匿名2021-01-18 06:36 (4天前)回复 Windows 10 | Chrome 62.0.3202.94
  2. I feel very lucky to follow your page
    匿名2021-01-09 20:09 回复 Windows 10 | Chrome 62.0.3202.94
  3. I think it is a fluent sharing, I will recommend your site to my friends
    匿名2021-01-04 17:24 回复 Windows 10 | Chrome 62.0.3202.94
  4. Thanks again for the article. Really Cool.
    匿名2021-01-01 09:51 回复 Windows 10 | Chrome 62.0.3202.94
  5. Hi there, this weekend is good in support of me, because this point in time i am reading this fantastic educational paragraph here at my residence.my site :: Janice
    匿名2020-12-26 04:39 回复 Mac OS X | Chrome 67.0.3396.79
  6. Thank you for your blog post.Thanks Again. Phillip Leffew
    匿名2020-12-23 01:18 回复 Windows 10 | Chrome 62.0.3202.94
  7. Thanks so much for providing individuals with an extraordinarily remarkable opportunity to discover important secrets from here. It’s usually very pleasurable and also jam-packed with fun for me personally and my office colleagues to visit your site minimum thrice in one week to study the newest issues you have. Of course, I’m just actually motivated for the breathtaking opinions you give. Selected 3 facts on this page are surely the most suitable we have had. Daisy Drumm
    匿名2020-12-21 05:32 回复 Windows 10 | Chrome 62.0.3202.94
  8. This is one awesome article post.Really thank you! Want more. Jenise Vanderpol
    匿名2020-12-19 11:52 回复 Windows 10 | Chrome 62.0.3202.94
  9. I value the article post.Thanks Again. Much obliged. Collette Brevik
    匿名2020-12-15 14:54 回复 Windows 10 | Chrome 62.0.3202.94
  10. Major thanks for the blog.Thanks Again. Fantastic. Fae Madnick
    匿名2020-12-11 04:06 回复 Windows 10 | Chrome 62.0.3202.94
  11. Glad to see that this site works well on my Google phone , everything I want to do is functional. Thanks for keeping it up to date with the latest. Mabel Barthel Cathie
    720p izle2020-12-10 09:07 回复 Windows 10 | Chrome 86.0.4240.193