60分求助!
查看原帖
60分求助!
920794
ljx15653581765楼主2023/2/6 18:01

#include #include using namespace std; int yh[15][15]; int main(){

   cin>>n;
   yh[1][1]=1;
   
   for(int i=2;i<=n;i++)//行 
       for(int j=1;j<=i;j++) //列 
           yh[i][j]=yh[i-1][j-1]+yh[i-1][j];
   for(int i=1;i<=n;i++){
   	for(int j=1;j<=i;j++)
   		cout<<yh[i][j]<<' ';
   	cout<<endl;
   }
   return 0;
}
2023/2/6 18:01
加载中...