Source Code
#include <iostream>
#include <set>
#include <map>
#include <vector>
using namespace std;

int main() {
	int L,P;
	cin>>L>>P;
	vector<vector<int>> sha7ta(10);
	sha7ta[0] = {1};
	for(int i=1;i<10;i++){
		for(int j = 0; j< sha7ta[i-1].size(); j++){
			sha7ta[i].push_back(sha7ta[i-1][j]);
		}
		sha7ta[i].push_back(i+1);
		for(int j = 0; j< sha7ta[i-1].size(); j++){
			sha7ta[i].push_back(sha7ta[i-1][j]);
		}
	}
	for(int i=0;i<L;i++){
		for(int j=0;j<P;j++){
			cout<<"-";
		}
		cout<<i<<endl;
		if(P > 1)
		for(int j=0;j<sha7ta[P-2].size();j++){
			for(int k=0;k<sha7ta[P-2][j];k++)
				cout<<"-";
			cout<<endl;
		}
	}
	for(int j=0;j<P;j++){
			cout<<"-";
		}
	cout<<L;
	return 0;
}
Copy
Ruler Bahou
GNU G++17
13 ms
932 KB
Accepted