Source Code
#include <iostream>
using namespace std;
string calc( int a ){
	if ( a == 1 ) return "-" ;
	string s = "" ;
	for ( int i = 0 ; i < a ; i++ )  {
		s += '-' ;
	}
	s += "\n" ;
	string b = calc(a-1)+"\n";
	return b+s+b ;
}
int main() {
	int l , p;
	cin >> l >> p;
	for ( int i = 0 ; i <= l ; i++ ) {
		for(int j=0;j<p;j++)cout << '-' ;
		cout << i << endl ;
		cout << calc(p-1);
	}
	return 0;
}
Copy
Ruler SAAD
GNU G++17
2 ms
304 KB
Wrong Answer