1 条题解

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

      极简代码

      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n;
          cin >> n;
          for (int i = 1;i <= n;i++)
          {
              for (int j = 1;j <= n;j++)
              {
                  cout << setw(3) << max(n + 1 - i,j);
              }
              cout << endl;
          }
      }
      
  • 1

信息

ID
202
时间
1000ms
内存
16MiB
难度
1
标签
递交数
42
已通过
36
上传者