奇怪的码风
  • 板块灌水区
  • 楼主Engulf
  • 当前回复20
  • 已保存回复20
  • 发布时间2021/11/13 16:58
  • 上次更新2023/11/4 00:42:21
查看原帖
奇怪的码风
482728
Engulf楼主2021/11/13 16:58
#include<bits/stdc++.h>
using namespace std;char s[1050][2050];void draw(int res,int x,int y){if(res==1){s[x-1][y+1]='/';s[x-1][y+2]='\\';s[x][y]='/';s[x][y+1]=s[x][y+2]='_';s[x][y+3]='\\';}else{draw(res-1,x,y);draw(res-1,x,y+pow(2,res));draw(res-1,x-pow(2,res-1),y+pow(2,res-1));}}int main(){int n;cin>>n;draw(n,pow(2,n),1);for(int i=1;i<=pow(2,n);i++){for(int j=1;j<=2*pow(2,n);j++){if(s[i][j]=='\0')cout<<' ';else cout<<s[i][j];}cout<<endl;}return 0;}
2021/11/13 16:58
加载中...