问题标题: 酷町堂:3401 画图

0
0
徐子宸
徐子宸
中级天翼
中级天翼

#include<bits/stdc++.h>

#pragma GCC optimize(3)

using namespace std;

string s[2][1]={"/\\","/__\\"};

int main(){

    int n;

    cin>>n;

    int a=4*(n-1);

    for(int i=1;i<=2*(n-1);i++){

        if(i%2==1){

            for(int j=1;j<=a-1;j++){

                cout<<' ';

            }

            a--;

            int k=(i+1)/2;

            for(int j=1;j<=k;j++){

                cout<<s[0][0]<<" ";

            }

            cout<<endl;

            for(int j=1;j<=a-1;j++){

                cout<<' ';

            }

            a--;

            for(int j=1;j<=k;j++){

                cout<<s[0][1]<<" ";

            }

            cout<<endl;

        }else{

            for(int j=1;j<=a-1;j++){

                cout<<' ';

            }

            a--;

            int k=i;

            for(int j=1;j<=k;j++){

                cout<<s[0][0]<<" ";

            }

            cout<<endl;

            for(int j=1;j<=a-1;j++){

                cout<<' ';

            }

            a--;

            for(int j=1;j<=k;j++){

                cout<<s[0][1];

            }

            cout<<endl;

        }

    }

    return 0;

}

30分代码,谁来看看!

徐子宸在2021-08-24 12:37:35追加了内容

来个人啊


1
曹灿阳
曹灿阳
初级天翼
初级天翼

如果你答应不再在问答里发布我的私事,或者诽谤我的话,那我可以告诉你

0
0
0
0
我要回答