7 条题解

  • 0
    @ 2023-12-19 16:27:29
    #include <iostream>
    using namespace std;
    const int INF = 0x3f3f3f3f;
    const int N = 1e5 + 10;
    
    int n;
    
    int main()
    {
    	cin >> n;
    	for(int i = 1; i <= n; i++)//代表行号 
    	{
    		for(int j = 1; j <= n - i; j++)
    			cout << " ";
    		for(int j = 1; j <= 2 * i - 1; j++)
    			cout << "*";
    			
    		for(int j = 1; j <= n - 1; j++)
    		{
    			for(int k =1 ; k <= 2 * n - 1 - 2 * (i - 1); k++)
    				cout << " ";
    			for(int j = 1; j <= 2 * i - 1; j++)
    				cout << "*";
    		}
    		cout << endl;
    	}
    
        return 0;
    }
    

    信息

    ID
    956
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    递交数
    372
    已通过
    183
    上传者