Source Code
#include <bits/stdc++.h>
using namespace std;

void RecursivePrint(int length){
    if(length == 0) return;
    
    RecursivePrint(length-1);
    for(int i=0; i<length; i++) cout << "-";
    cout << endl;
    RecursivePrint(length-1);
    
}

void solve(){
    int l , p;
    
    cin >> l >> p;
    for(int i=0; i<l; i++)
    {
        for(int j=0; j<p; j++)
            cout << "-";
        cout << i << endl;
     RecursivePrint(p-1);
    }
    for(int j=0; j<p; j++)
        cout << "-";
    cout << l << endl;

}

int main(){
    solve();
return 0;
}
Copy
Ruler hamzah_lababidi
GNU G++17
12 ms
856 KB
Accepted