2 条题解

  • 0
    @ 2023-11-16 6:13:15
    #include <bits/stdc++.h>
    using namespace std;
    int n;
    int a[101][101];
    int main() {
    	cin >> n;
    	for (int i = 1; i <= n; i++) {
    		int x = 1;
    		for (int j = 1; j <= n; j++) {
    
    			if (x <= i) {
    				a[i][j] = x;
    				x++;
    			} else
    				a[i][j] = i;
    		}
    	}
    	for (int i = n; i >= 1; i--) {
    		for (int j = 1; j <= n; j++)
    			cout << setw(3) << a[i][j];
    		cout << endl;
    	}
    	return 0;
    }
    
    • 0
      @ 2023-5-3 15:54:55
      #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] = min(i, j);
              }
          }
          for (int i = n; i >= 1; i--)
          {
              for (int j = 1; j <= n; j++)
              {
                  cout << "  " << a[i][j];
              }
              cout << endl;
          }
          return 0;
      }
      
      • 1

      信息

      ID
      201
      时间
      1000ms
      内存
      16MiB
      难度
      1
      标签
      递交数
      41
      已通过
      37
      上传者