样例对了,全WA
查看原帖
样例对了,全WA
992369
0o0o0o0o楼主2024/6/29 15:55
#include<bits/stdc++.h>
using namespace std;
int n;
char a[2000][2000];
int h=2,w=4;
int main() { 
	cin>>n;
	int m=pow(2,n)-1;
	a[1][1]=a[1][4]=' ';
	a[1][2]=a[2][1]='/';
	a[1][3]=a[2][4]='\\';
	a[2][2]=a[2][3]='_';
	for(int i=1;i<n;i++)
	{
		for(int j=1;j<=h;j++)
		{
			for(int k=1;k<=w;k++)
			{
				a[j+h][k]=a[j+h][k+w]=a[j][k];
			}
		}
		w*=2,h*=2;
	}
	for(int i=1;i<=h;i++)
	{	
		if(i%2!=0)
		{
			m=m-1;
		}
	    for(int k=1;k<=m;k++)
		{
				cout<<" ";
		}
		
		int pos = w;
		while(a[i][pos] == ' ' || !a[i][pos]) pos --;
		
		for(int j=1;j<=pos;j++)
		{

			cout<<a[i][j];
		}
		
		if(i%2==0)m=m-1;
		
		cout<<endl;
	}
	return 0;
}
2024/6/29 15:55
加载中...