Source Code
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define p1 2*p
#define p2 p1+1
#define ll long long
#define pb push_back
#define LFT p1,L,Mid
#define pf push_front
#define Mid ((L+R)/2)
#define RGT p2,Mid+1,R
#define pi pair<int,int>
#define pii pair<pi,pi>
#define deb(x) cout<<#x<<"="<<x<<endl
#define go ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
void print(int x)
{
    if(x==1)
        return;
    print(x-1);
    for(int i=0;i+1<x;i++)
        cout<<'-';
    cout<<endl;
    print(x-1);
}
int main()
{
    go;
    int a,b;
    cin>>a>>b;
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<b;j++)
            cout<<'-';
        cout<<i<<endl;
        print(b);
    }
    for(int j=0;j<b;j++)
            cout<<'-';
    cout<<a<<endl;
    return 0;
}
Copy
Ruler Grapeee
GNU G++17
12 ms
980 KB
Accepted