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: 5628kB
Author: fyk19980409
In contest: 1090

#include<iostream>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;

int ans[1001][1001];
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int hang=1;
		int i=0,j=0;
		int cnt=1;
		while(hang<=n)
		{
			while(i>=0)
			{
				ans[i][j]=cnt;
				cnt++;
				i--;
				j++;
			}
			hang++;
			i=hang-1;
			j=0;
		}
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<(n-i);j++)
			{
				printf("%d",ans[i][j]);
				if(j<n-i-1)printf(" ");
			}
			printf("\n");
		}
	}
	
}