1 solutions

  • 1
    @ 2026-8-20 20:54:45
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	int x=n/2+1,y=x;
    	for (int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=n;j++)
    		{
    			if(abs(i-x)+abs(j-y)==x-1) //边缘判断
    			{
    				cout<<"#";
    			}
    			else
    			{
    				cout<<".";
    			}
    		}
    		cout<<endl;
    	}
    	return 0;
    }	
    
    • 1

    Information

    ID
    2887
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    4
    Tags
    # Submissions
    44
    Accepted
    21
    Uploaded By