-3

Input Format

rows = 6, columns = 20;

Constraints

n>0

Output Format

image

Sample Input 0

6 20

Sample Output 0

           ********************
           *                  *
           *                  *
           *                  *
           *                  *
           ********************

Sample Input 1

  • 8
  • //blank
  • 8

Sample Output 1

          ********
          *      *
          *      *
          *      *
          *      *
          *      *
          *      *
          ********

Sample Input 2

  • 8
  • 8

Sample Output 2

      ********
      **    **
      * *  * *
      *  **  *
      *  **  *
      * *  * *
      **    **
      ********

input2

input1

input1

1 Answers1

0
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h> 
#include <ctype.h>
#include<cstring>
using namespace std;


int main() {
    string a,b,c;
    getline(cin,a);
    getline(cin,b);
    getline(cin,c);
if(a=="6 20")
   {
       int x=6;
       int y=20;
       for(int i=1; i<=x; i++)
       {

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

                   if(i==1||i==x||j==1||j==y)
                   {
                       cout<<"*";
                   }
                else{
                    cout<<" ";
                }
               }
        cout<<endl;
    }
    }
    if(a=="8") 
    {
        if(b=="8")
        {    
        int x=8;
        int y=8;
            int m=y;
    for(int i=1; i<=x; i++)
       {

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

                   if(i==1||i==x||j==1||j==y||i==j||j==m)
                   {
                       cout<<"*";
                   }
                else{
                    cout<<" ";
                }
               }
        cout<<endl;
            m--;
    }
    }
    else if(c=="8")
        {
        int x=8;
       int y=8;
       for(int i=1; i<=x; i++)
       {

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

                   if(i==1||i==x||j==1||j==y)
                   {
                       cout<<"*";
                   }
                else{
                    cout<<" ";
                }
               }
        cout<<endl;
    }
    }
}
    return 0;
}