Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我的一个小程序(利用一维数组)#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator