http://poj.org/problem?id=2083
Together, I think it's a little disgusting. DFS was initially not initialized with g++, and then with C + + turned out to be WA. That must be my problem.
Finally found no initialization
Dfs still feels like it's not too much to know when to really learn
#include <stdio.h>#include<string.h>#include<algorithm>#include<stdlib.h>#include<math.h>#include<iostream>using namespacestd;#defineN 1100#defineINF 0xFFFFFFFF#defineMemset (A, B) memset (A,b,sizeof (a))CharStr[n][n];voidDasointNintXinty) { if(n==1) {Str[x][y]='X'; return; } intH=pow (3.0, N-2); DFS (n-1, x, y), or///upper-left corner DFS (n-1, x,y+2*h)////upper right-hand corner DFS (n-1, x+h,y+h);///Intermediate DFS (n-1, x+2*h,y)///////lower left corner DFS (n-1, x+2*h,y+2*h);///Lower right corner}intMain () {memset (str,' '); DFS (7,1,1); intm; while(SCANF ("%d", &m), m!=-1) { intD=pow (3.0, M-1); for(intI=1; i<=d;i++) { for(intj=1; j<=d;j++) {printf ("%c", Str[i][j]); } printf ("\ n"); } printf ("-\n"); } return 0;}
Fractal---POJ2083 (dfs)