csdoge


私信TA

用户名:csdoge

访问量:2520

签 名:

等  级
排  名 2023
经  验 2411
参赛次数 0
文章发表 23
年  龄 0
在职情况 学生
学  校 南京邮电大学
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<vector>

#include<utility>

#include<map>

using namespace std;

char cnt[150][150];

int main(){

int n;

cin>>n;

int tx=0,ty=0;

memset(cnt,'.',sizeof(cnt));

for(int i=n;i>=0;i--){

for(int j=ty+2;j<=ty+4*i+2;j++){

    cnt[tx][j]='$';

}

for(int j=tx;j<=tx+2;j++){

cnt[j][ty+2]='$';

cnt[j][ty+4*i+2]='$';

}

for(int j=ty+1;j>=ty;j--){

cnt[tx+2][j]='$';

}

for(int j=ty+4*i+3;j<=ty+4*i+4;j++){

cnt[tx+2][j]='$';

}

for(int j=tx+3;j<=tx+4*i+2;j++){

cnt[j][ty]='$';

}

for(int j=tx+3;j<=tx+4*i+2;j++){

cnt[j][ty+4*i+4]='$';

}

for(int j=ty+1;j<=ty+2;j++){

cnt[tx+4*i+2][j]='$';

}

for(int j=ty+4*i+2;j<=ty+4*i+4;j++){

cnt[tx+4*i+2][j]='$';

}

        for(int j=tx+4*i+3;j<=tx+4*i+4;j++){

        cnt[j][ty+2]='$';

}

for(int j=tx+4*i+3;j<=tx+4*i+4;j++){

cnt[j][ty+4*i+2]='$';

}

for(int j=ty+3;j<=ty+4*i+1;j++){

cnt[tx+4*i+4][j]='$'; 

tx=tx+2;

ty=ty+2;

}

for(int i=0;i<4*n+5;i++){

for(int j=0;j<4*n+5;j++){

printf("%c",cnt[i][j]);

}

printf("\n");

}

return 0;


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区