1 条题解

  • 1
    @ 2025-8-1 8:46:25
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	long long int a[100][100],n;//注意要用longlong;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    	a[i][1]=1;
    	a[i][i]=1;
        }
    	for(int i=2;i<=n;i++)
    	{
    		for(int j=2;j<=i;j++)
    		a[i][j]=a[i-1][j-1]+a[i-1][j];
    	}
    	for(int i=1;i<=n;i++)
    	{
            for(int j=1;j<=i;j++)
    		{
    			cout<<a[i][j]<<" ";
    		}
    		cout<<endl;
    	}
    }
    
    
    
    • 1

    信息

    ID
    184
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    (无)
    递交数
    7
    已通过
    7
    上传者