Problem 2665 --Recursion / Divide and Conquer - Koch Curve

2665: Recursion / Divide and Conquer - Koch Curve

"
Time Limit $2$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $1$ 正确数量 $2$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL

Koch Curve

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). 

You should start (0, 0), (100, 0) as the first segment.

An integer n is given.
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.
1
0.00000000 0.00000000
33.33333333 0.00000000
50.00000000 28.86751346
66.66666667 0.00000000
100.00000000 0.00000000
0 ≤ n ≤ 6

推荐代码 查看2665 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$6 $ms] Hunter 761225 2021-07-22 15:52:39
内存最少[$2224 $KB] Hunter 761225 2021-07-22 15:52:39
第一AC 囧囧JOJO 756669 2021-06-13 23:16:57
第一挑战 AOJ大管家 437217 2019-06-08 13:00:49

赛题来源/所属竞赛 会津大学《挑战数据结构与算法》 挑战数据结构与算法

竞赛编号 竞赛名称 竞赛时间 访问比赛