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: 7ms
Memory: 1712kB
Author: lucy
In contest: 1090

#include<iostream>  
#include<iomanip>
#include<stdio.h>
using namespace std;
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int totalline,i,lnum,dline,fl;
		i=1;
		totalline=n;
		while(i<=n)
		{
			int temp=i;
			lnum=n-i+1;
			dline=i+1;
			fl=1;
			while(temp--)
				fl+=temp;
			while(lnum--)
			{
				if(lnum!=0)
				printf("%d ",fl);
				if(lnum==0)
					printf("%d",fl);
				fl+=dline;
				++dline;
			}
			printf("\n");
			i++;
		}
	}
	return 0;
}