- 龙凤苑中学C班5.14
杨辉三角可复制
- @ 2024-5-14 17:11:48
#include<bits/stdc++.h>
using namespace std;
int n,c[200][200];
int main()
{
c[1][1]=1;
cin>>n;
/*for(int i=2;i<=n;i++)
{
for(int j=1;j<=i:j++)
{
c[i][j]=c[i-1][j-1]+c[i-1][j];
}
}*/
cout<<1<<endl;
for(int i=2;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
c[i][j]=c[i-1][j-1]+c[i-1][j];
cout<<c[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
0 comments
No comments so far...