Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我的一个小程序(利用一维数组)

Posted by thincal at 2004-04-24 10:54:58 on Problem 1653
#include<iostream.h>
#include<iomanip.h>

#define MAX 50
void main()
{
	int i,j,n;
	int a[MAX];
	cin>>n;
	for(i=0;i<n;i++)
	{
		{
			for(j=i;j>=0;j--)
			   if(j==i||j==0)
				  a[j]=1;
			   else a[j]=a[j-1]+a[j];
		    for(i=0;i<=j;i++)
			cout<<setw(4)<<a[i];
		}
		cout<<endl;
	}
	     
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator