3 条题解

  • 1
    @ 2024-2-18 14:49:54
    #include <iostream>
    using namespace std;
    int main()
    {
        int n, x = 1;
        cin >> n;
        for (int i = 1; i <= n; i++)
        {
            for (int j = x; j <= x + (n - 1) * n; j += n)
            {
                if (j < 10)
                {
                    cout << "  ";
                }
                else
                {
                    cout << " ";
                }
                cout << j;
            }
            x++;
            cout << endl;
        }
        return 0;
    }
    
    • 1
      @ 2023-4-9 15:54:39
      #include <iostream>
      using namespace std;
      int main()
      {
          int n, x;
          cin >> n;
          int a[n + 1][n + 1];
          for (int i = 1; i <= n; i++)
          {
              x = i;
              for (int j = 1; j <= n; j++)
              {
                  a[i][j] = x;
                  if (a[i][j] / 10 == 0)
                  {
                      cout << "  " << a[i][j];
                  }
                  else
                  {
                      cout << " " << a[i][j];
                  }
                  x += n;
              }
              cout << endl;
          }
          return 0;
      }
      
      • 0
        @ 2023-4-13 19:25:45

        猜猜哪个是这题答案?

        #include <iostream>
        using namespace std;
        int main()
        {
            int n;
            cin >> n;
            for(int i=1;i<=n;i++)
            {
                cout << " ";
                for(int j=1;j<=n;j++)
                {
                    if((j-1)*n+i<10)
                    {
                        cout << " ";
                    }
                    cout << (j-1)*n+i << " ";
                }
                cout << endl;
            }
        }
        
        #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-1)*n+j<10)
                    {
                        cout << " ";
                    }
                    cout << (i-1)*n+j << " ";
                }
                cout << endl;
            }
        }
        
        #include <iostream>
        using namespace std;
        int main()
        {
            int n;
            cin >> n;
            for(int i=1;i<=n;i++)
            {
                cout << " ";
                for(int j=1;j<=n;j++)
                {
                    if((i-1)*n+j<10)
                    {
                        cout << " ";
                    }
                    cout << (i-1)*n+j << " ";
                }
                cout << endl;
            }
        }
        
      • 1

      信息

      ID
      186
      时间
      1000ms
      内存
      16MiB
      难度
      1
      标签
      递交数
      101
      已通过
      69
      上传者