9 solutions

  • -2
    @ 2024-7-9 10:06:19
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int a,b,t;
        char n; 
        cin>>a>>b>>n>>t;
        if(t==1)
        {
            for(int i=1;i<=a;i++)
            {
                for(int j=1;j<=b;j++)
                {
                    cout<<n;
                }
                cout<<endl;
            }
        }
        else if(t==0)
        {
            for(int i=1;i<=a;i++)
            {
                if(i==1)
                {
                    for(int j=1;j<=b;j++)
                    {
                        cout<<n;
                    }
                }
                else if(i>1 && i<a)
                {
                    cout<<n;
                    for(int j=1;j<+b-1;j++)
                    {
                        cout<<" ";
                    }
                    cout<<n;
                }
                else if(i==a)
                {
                    for(int j=1;j<=b;j++)
                    {
                        cout<<n;
                    }
                }
                cout<<endl;
            }
        }
        return 0;
    }
    

    Information

    ID
    885
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    107
    Accepted
    45
    Uploaded By