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

int main() {
	vector<string> pp(100);
	pp[0]="";
	for(int i=1;i<10;i++){
		string ss = "";
		for(int j=0;j<i;j++){
			ss+='-';
		}
		ss+='\n';
		pp[i] = pp[i-1] + ss + pp[i-1];
	}
	int l,p;
	cin>>l>>p;
	string s = "";
	for(int i=0;i<p;i++){
		s+='-';
	}
	for(int i=0;i<=l;i++){
		cout<<s<<i<<endl;
		if(i!=l)
			cout<<pp[p-1];
	}
	return 0;
}
Copy
Ruler Saq
GNU G++17
2 ms
964 KB
Accepted