2 条题解

  • 1
    @ 2023-5-3 15:46:11
    #include <iostream>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        int a[n + 1][n + 1];
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                a[i][j] = max(n + 1 - i, n + 1 - j);
            }
        }
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                cout << "  " << a[i][j];
            }
            cout << endl;
        }
        return 0;
    }
    
    • 0
      @ 2023-11-14 14:21:29

      #include <bits/stdc++.h> using namespace std; int n; int a[100][100]; int main() { cin >> n; for (int i = 1; i <= n; i++) { int x = n; for (int j = 1; j <= n; j++) { if (x > i) { a[i][j] = x; x--; } else a[i][j] = x; } } for (int i = n; i >= 1 ; i--) { for (int j = 1; j <= n; j++) { cout << setw(3) << a[i][j]; } cout << endl; } return 0; }

      • 1

      信息

      ID
      198
      时间
      1000ms
      内存
      16MiB
      难度
      1
      标签
      递交数
      45
      已通过
      40
      上传者