#include<stdio.h>
#include<stdlib.h>
#include<math.h>
 
#define PI 3.1415926535
 
typedef struct{
  double x;
  double y;
}Point;
 
void KochCurve(Point,Point,int);
 
int main(void){
  int n;
  Point p1={0,0};
  Point p2={100,0};
 
  scanf("%d", &n);
 
  printf("%.8f %.8f\n", p1.x, p1.y);
  KochCurve(p1,p2,n);
  printf("%.8f %.8f\n", p2.x, p2.y);
 
  return 0;
}
 
void KochCurve(Point p1, Point p2, int n){
  Point p3,p4,p5;
 
  if(n==0) return;
 
  p3.x=(2*p1.x+p2.x)/3.0;
  p3.y=(2*p1.y+p2.y)/3.0;
  p4.x=(p1.x+2*p2.x)/3.0;
  p4.y=(p1.y+2*p2.y)/3.0;
  p5.x=(p4.x-p3.x)*cos(PI/3)-(p4.y-p3.y)*sin(PI/3)+p3.x;
  p5.y=(p4.x-p3.x)*sin(PI/3)+(p4.y-p3.y)*cos(PI/3)+p3.y;
 
  KochCurve(p1,p3,n-1);
  printf("%.8f %.8f\n", p3.x, p3.y);
  KochCurve(p3,p5,n-1);
  printf("%.8f %.8f\n", p5.x, p5.y);
  KochCurve(p5,p4,n-1);
  printf("%.8f %.8f\n", p4.x, p4.y);
  KochCurve(p4,p2,n-1);
 
  return;
}

Compile Error Logs:

Status
Judge: 5/5	C	CPU: 00.00 sec	Memory: 640 KB	Length: 880 B	2017-08-21 00:14	2017-08-21 00:14
Results for testcases
Case #	Verdict	CPU Time	Memory	In	Out	Case Name
Case #1:	: Accepted	00.00 sec	628 KB	2 B	46 B	test_case_1
Case #2:	: Accepted	00.00 sec	640 KB	2 B	396 B	test_case_2
Case #3:	: Accepted	00.00 sec	636 KB	2 B	1515 B	test_case_3
Case #4:	: Accepted	00.00 sec	640 KB	2 B	23894 B	test_case_4
Case #5:	: Accepted	00.00 sec	640 KB	2 B	95510 B	test_case_5

< prev |	1	/	5	| next >	 		 : Accepted        00.00 sec        628 KB
 
Judge Input #1 ( in1.txt | 2 B)		Judge Output #1 ( out1.txt | 46 B)
0
0.00000000 0.00000000
100.00000000 0.00000000
Comments
 
 Under Construction.
 
Categories
 

Add Category:		Submit
* Note for the classification	
 
Free Tags
 

Add Tag:	
Submit	Please add a tag related to 'algorithm'.
 