样例过了但全错 qvq
  • 板块P1498 南蛮图腾
  • 楼主zzz987
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/8/5 00:26
  • 上次更新2024/8/5 01:15:45
查看原帖
样例过了但全错 qvq
1171003
zzz987楼主2024/8/5 00:26
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
const int N=pow(2,11);
char a[N][N];
int n;
void f(int x,int y,int k){
//	cout <<x<<" "<<y<<" "<<k<<endl;
	if(k==1){
		a[x][y+1]='/',a[x+1][y]='/';
		a[x][y+2]='\\',a[x+1][y+3]='\\';
		a[x+1][y+1]='-',a[x+1][y+2]='-';
		return ;
	}
	f(x,y+pow(2,k-1),k-1);
	f(x+pow(2,k-1),y,k-1);
	f(x+pow(2,k-1),y+pow(2,k),k-1);
}
int main(){
	memset(a,' ',sizeof a);
	cin >>n;
	f(0,0,n);
	for(int i=0;i<pow(2,n);i++){
		for(int j=0;j<pow(2,n+1);j++){
			cout <<a[i][j];
		}
		cout <<endl;
	}
	return 0; 
} 
2024/8/5 00:26
加载中...