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

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<iomanip>
#include<limits.h>
#include<stdlib.h>
#include<set>
#include<sstream>
#include<vector>
#include<list>
#include<vector>
#include<map>
#include<stack>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++){
	if(i<=2){
	for(int j=1;j<=n-i+1;j++){
		if(j!=n-i+1){
		cout<<0.5*j*j+((2*i-1)/2.0)*j<<" ";
		}
		else
			cout<<0.5*j*j+((2*i-1)/2.0)*j<<endl;
	}}
	else{
	for(int j=1;j<=n-i+1;j++){
		if(j!=n-i+1){
		cout<<0.5*j*j+((2*i-1)/2.0)*j+0.5*(i-2)*(i-2)+0.5*(i-2)<<" ";
		}
		else
			cout<<0.5*j*j+((2*i-1)/2.0)*j+0.5*(i-2)*(i-2)+0.5*(i-2)<<endl;
	}
	}
}
return 0;
}