UKE求助
查看原帖
UKE求助
886055
MoonCake2011楼主2023/6/15 14:37
#include<bits/stdc++.h>
using namespace std;
int n;
char a[1050][2000];
void out1(){
	printf(" /\\");
}
void out2(){
	printf("/__\\"); 
}
void go(int x,int y,int step){
	if(step==1){
		a[x][y]='/';
        a[x][y+1]='\\';
        a[x+1][y-1]='/';
        a[x+1][y]='_';
        a[x+1][y+1]='_';
        a[x+1][y+2]='\\'; 
		return;
	}
	go(x,y,step-1);
	go(x+(1<<step-1),y-(1<<step-1),step-1);
	go(x+(1<<step-1),y+(1<<step-1),step-1);
	return; 
}
int main() {
	cin>>n;
	memset(a,' ',sizeof a);
	go(1,1<<n,n);
	for(int i=1;i<=(1<<n);i++){
		for(int j=1;j<=(1<<n+1);j++){
			cout<<a[i][j]; 
		}
		cout<<"\n"; 
	}
	return 0;
}
2023/6/15 14:37
加载中...