2 条题解

  • 1
    @ 2023-4-14 19:44:57
    #include <iostream>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        for(int i=n;i>=1;i--)
        {
            cout << " ";
            for(int j=1;j<=n;j++)
            {
                if(i*n-j+1<=9)
                {
                    cout << " ";
                }
                cout << i*n-j+1 << " ";
            }
            cout << endl;
        }
    }
    
    
    • 1
      @ 2023-4-9 16:07:37
      #include <iostream>
      using namespace std;
      int main()
      {
          int n;
          cin >> n;
          int x = n * n, a[n][n];
          for (int i = 1; i <= n; i++)
          {
              for (int j = 1; j <= n; j++)
              {
                  a[i][j] = x;
                  x--;
                  if (a[i][j] / 10 == 0)
                  {
                      cout << "  " << a[i][j];
                  }
                  else
                  {
                      cout << " " << a[i][j];
                  }
              }
              cout << endl;
          }
          return 0;
      }
      
      • 1

      信息

      ID
      188
      时间
      1000ms
      内存
      16MiB
      难度
      1
      标签
      递交数
      88
      已通过
      63
      上传者