题目1073:杨辉三角形

http://ac.jobdu.com/problem.php?pid=1073

View Code
 1 #include<iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int n;
 6     int i,j,t;
 7     while(cin>>n)
 8     {
 9         for(i=2;i<=n;++i)
10         {
11             t=1;
12             j=1;
13             while(t)
14             {
15                 if(j!=1)
16                     cout<<" ";
17                 cout<<t;
18                 t=(t*(i-j))/j;
19                 ++j;
20             }
21             cout<<endl;
22         }
23     }
24     return 0;
25 }

 

posted @ 2013-01-23 15:04  dupuleng  阅读(102)  评论(0)    收藏  举报