Start: May, 31, 2017 13:30:00
2017ACM通识课期末考试
End: May, 31, 2017 17:30:00
Time elapsed:
Time remaining:

Problem_ID: I
Result: Accepted
Time: 6ms
Memory: 1712kB
Author: 2016210402062
In contest: 1090

#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int i,n,j,row;
	int cnt[1001]={0,1};
	int now;
	for(i=2;i<1001;i++){
		cnt[i]=cnt[i-1]+i-1;
	}

	while(cin>>row){

		for(i=1;i<=row;i++){
			now=cnt[i];
			cout<<now;
			if(i==row) cout<<endl;
			else cout<<' ';

			for(j=2;j<=row-i+1;j++){
				now+=j+i-1;
				cout<<now;
				if(j==row-i+1)cout<<endl;
				else cout<<' ';
			}
		}


	}
	return 0;
}