fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. for(int i = 0; i < n; ++i) {
  8. for(int j = 0; j < n; ++j) {
  9. if(i <= j) {
  10. cout << j*(j+1)/2+1 + i;
  11. }
  12. cout << '\t';
  13. }
  14. cout << endl;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 3460KB
stdin
6
stdout
1	2	4	7	11	16	
	3	5	8	12	17	
		6	9	13	18	
			10	14	19	
				15	20	
					21