12 条题解

  • -2
    @ 2022-1-12 12:02:48
    #include <math.h>
    #include <stack>
    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <iomanip>
    #include <string.h>
    #include <algorithm>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int main()   
    {
    	int n;
    	cin>>n;
    	n/=2;
    	for(int i=1;i<=n+1;i++)
    	{
    		for(int j=1;j<=n*2+1;j++)
    		{
    			if(n-i+2<j&&n+i>j)
    			{
    				cout<<" ";
    			}
    			else
    			{
    				cout<<"*";
    			}
    		}
    		cout<<endl;
    	}
    	for(int i=n;i>=1;i--)
    	{
    		for(int j=1;j<=n*2+1;j++)
    		{
    			if(n-i+2<j&&n+i>j)
    			{
    				cout<<" ";
    			}
    			else
    			{
    				cout<<"*";
    			}
    		}
    		cout<<endl;
    	}
    }
    

    信息

    ID
    953
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    374
    已通过
    215
    上传者