感觉输出明明对了啊,为啥全wa
查看原帖
感觉输出明明对了啊,为啥全wa
719843
lizhuorong楼主2023/11/4 14:16
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
using namespace std;
int a[100][100];
int main(){
	int n;
	cin>>n;
	n=pow(2,n);
	int c=n;
	for(int i=1;i<=n;i++){
		for(int i=c;i>0;i--){
			cout<<" ";
		}
		c--;
		for(int k=1;k<=i;k++){
			if(k==1 || k==i || a[i-1][k-1]+a[i-1][k]%2==1){
				a[i][k]=1;
			}
			else{
				a[i][k]=0;
			}
			if(i%2==1&&a[i][k]==1){
				cout<<"/\\";
			}
			else if(i%2==0&&k%2==1&&a[i][k]==1){
				cout<<"/_";
			}
			else if(i%2==0&&k%2==0&&a[i][k]==1){
				cout<<"_\\";
			}
			else if(a[i][k]==0){
			    cout<<"  ";
			}
		}
		cout<<endl; 
	} 
}

2023/11/4 14:16
加载中...