Ideas:
Fractal.
Records the coordinates of the left-hand side of the center and then introduces the coordinates of the other 3 points, recursively to the simplest case.
Code:
#include <bits/stdc++.h>using namespacestd;#definell Long Long#definePB Push_back#defineMem (A, B) memset (A,b,sizeof (a))Charc[2200][2200];voidDfsintNintIintj) { if(n==1) {C[i][j]='O'; return ; } intt=n/3; DFS (T,i-t,j+t); DFS (T,i+t,j+t); DFS (T,I,J); DFS (T,i,j+2*t);}intMain () {Ios::sync_with_stdio (false); Cin.tie (0); intT,n; CIN>>T; while(t--) {cin>>N; intT= (int) Pow (3, N); for(intI=1;i<2200; i++){ for(intj=1;j<2200; j + +) C[i][j]=' '; } dfs (t, (t+1)/2,1); for(intI=1; i<=t;i++){ for(intj=t;j>=1; j--){ if(c[i][j]=='O') {c[i][j+1]=' /'; Break; } } } for(intI=1; i<=t;i++) {puts (C[i]+1); } } return 0;}
2018 National multi-school algorithm winter training Camp practice Competition (first game) G Circle