- 分形宇宙论
- @ 2024-07-30 16:45:54
#include <bits/stdc++.h>
using namespace std;
int n;
char a[1005][1005];
void fac(int x,int y,int n){
    if(n==1){
        a[x][y]='X';
        return ;
    }
    int step=pow(3,n-2);
    fac(x,y,n-1);
    fac(x,y+step*2,n-1);
    fac(x+step*2,y,n-1);
    fac(x+step,y+step,n-1);
    fac(x+step*2,y+step*2,n-1);
}
int main(){
    ios::sync_with_stdio(false);
    int t;
    cin>>t;
    n=pow(3,t-1);
    fac(1,1,t);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)cout<<a[i][j]<<" ";
        cout<<endl;
    }
    return 0;
}
1 条评论
- 
  240803gj徐嘉昊 (2212224徐嘉昊) LV 10 @ 2024-07-30 16:51:32你输出了空字符,评测机判定时要的是空格 
- 1
信息
- ID
- 1511
- 难度
- 7
- 分类
- (无)
- 标签
- 递交数
- 39
- 已通过
- 9
- 通过率
- 23%
- 被复制
- 4
- 上传者