求解
  • 板块P1498 南蛮图腾
  • 楼主wzy0
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/9/15 10:04
  • 上次更新2023/11/2 20:49:25
查看原帖
求解
830480
wzy0楼主2023/9/15 10:04

自己输出出来看着是对的, 但机器却WA了

#include<bits/stdc++.h>
using namespace std;

int n;
char s[4][2]={{' ','/'},{'/','_'},{'\\','_'},{' ','\\'}};
char c[10000][10000];

int tt(int m,int x,int y){
//	cout<<x<<' '<<y<<' ';
	if(m==1){
//		cout<<'*'<<'\n';
		for(int i=0;i<4;i++){
			for(int j=0;j<2;j++){
				c[x+i][y+j]=s[i][j];
			}
		}
		return 0;
	} 
//	cout<<endl;
	tt(m-1,x+(1<<(m-1)),y);
	tt(m-1,x,y+(1<<(m-1)));
	tt(m-1,x+(2<<(m-1)),y+(1<<(m-1)));
	return 0;
}

int main(){
//	freopen ( "P1498_1.in" , "r" , stdin) ;
//	freopen ( "x.out" , "w" , stdout) ;
	cin>>n;
	tt(n,0,0);
	for(int j=0;j<=(1<<n);j++){
		for(int i=0;i<=(2<<n);i++){
			cout<<c[i][j];
		}
		cout<<endl;
	}
	return 0;
}

/*
我输出的:
       /\
      /__\
     /\  /\
    /__\/__\
   /\      /\
  /__\    /__\
 /\  /\  /\  /\
/__\/__\/__\/__\

测试点的:
       /\
      /__\
     /\  /\
    /__\/__\
   /\      /\
  /__\    /__\
 /\  /\  /\  /\
/__\/__\/__\/__\

*/
2023/9/15 10:04
加载中...