1 条题解

  • 0
    @ 2024-3-30 9:47:21

    c++

    #include<bits/stdc++.h>
    using namespace std;
    int a[30][30];
    int main()
    {
    	int n;
    	cin>>n;
    	a[1][1]=1;
    	for(int i=2;i<=n;i++)
    	{
    		for(int j=1;j<=i;j++)
    		{
    			a[i][j]=a[i-1][j]+a[i-1][j-1];
    		}
    	}
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=i;j++)
    		{
    			cout<<a[i][j]<<" ";
    		}
    		cout<<endl;
    	}
    	return 0;
    }
    
    
    • 1

    信息

    ID
    748
    时间
    1000ms
    内存
    32MiB
    难度
    7
    标签
    (无)
    递交数
    22
    已通过
    8
    上传者