1 条题解

  • 0
    @ 2023-7-5 12:26:26
    #include <bits/stdc++.h>
    using namespace std;
    int n;
    int f[25][25];
    int main()
    {
        cin >> n;
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= i; j++)
                if (j == 1 || j == i)
                    f[i][j] = 1;
                else
                    f[i][j] = f[i - 1][j - 1] + f[i - 1][j];
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= i; j++)
                cout << f[i][j] << " ";
            cout << "\n";
        }
        return 0;
    }
    
    • 1

    信息

    ID
    1304
    时间
    1000ms
    内存
    256MiB
    难度
    3
    标签
    递交数
    36
    已通过
    23
    上传者