4 条题解

  • 0
    @ 2024-12-5 13:27:42

    #include<bits/stdc++.h> using namespace std; char c[80]; int main() {int n,h,H,a,e,E; cin>>n; for(int h=1,H=n;;h++,H--) {c[h]='x'; c[H]='x'; for(int k=1;k<=n;k++) {cout<<c[k]; } cout<<endl; c[h]=' '; c[H]=' '; if(hH) {e=h;E=h;a=1;break;} } for(;;e--,E++) {if(a!=1) { c[e]='x'; c[E]='x'; for(int k=1;k<=n;k++) {cout<<c[k]; } cout<<endl; c[e]=' '; c[E]=' '; if(e0) {break;} } else a++; } return 0; }

    • 0
      @ 2024-11-16 23:22:09
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int n,i,j;
          cin>>n;
          if(n>=3&&n<=79&&n%2==1)
          {
      	for(i=1;i<=n/2;i++)
          {
          	for(j=1;j<=i-1;j++)
          	{
          		cout<<" ";
      		}
          	cout<<"X";
          	for(j=1;j<=n-i*2;j++)
          	{
          		cout<<" ";
      		}
      		cout<<"X"<<endl;
      	}
      	for(i=1;i<=n/2;i++)
      	{
      		cout<<" ";
      	}
      	cout<<"X"<<endl;
      	for(i=n/2;i>=1;i--)
          {
          	for(j=1;j<=i-1;j++)
          	{
          		cout<<" ";
      		}
          	cout<<"X";
          	for(j=1;j<=n-i*2;j++)
          	{
          		cout<<" ";
      		}
      		cout<<"X"<<endl;
      	}
      	}
      	return 0;
      }
      
      • 0
        @ 2024-9-8 18:49:18
        #include<bits/stdc++.h>
        using namespace std;
        int main(){
        	int n;
        	cin>>n;
        	for(int i=1;i<=n/2;i++){
        		for(int j=0;j<i-1;j++){
        			cout<<" ";
        		}
        		cout<<"X";
        		for(int j=1;j<=n-2*i;j++){
        			cout<<" ";
        		}
        		cout<<"X"<<endl;
        	}
        	for(int i=1;i<=n/2;i++){
        		cout<<" ";
        	}
        	cout<<"X"<<endl;
        	for(int i=1;i<=n/2;i++){
        		for(int j=n/2-i;j>=1;j--){
        			cout<<" ";
        		}
        		cout<<"X";
        		for(int j=1;j<=i*2-1;j++){
        			cout<<" ";
        		}
        		cout<<"X"<<endl;
        	}
        } 
        
        • -5
          @ 2024-1-7 17:35:57

          #include<bits/stdc++.h>

          using namespace std;

          int main()

          {

          int n,o;

          cin>>n;

          o=n/2+1;

          for(int i=1;i<=o;i++)

          {

          for(int h=1;h<=i-1;h++)

          cout<<" ";

          if(i==o)

          {

          cout<<"X";

          }

          else

          {

          cout<<"X";

          for(int h=1;h<=(o-i)*2-1;h++)

          cout<<" ";

          cout<<"X";

          }

          cout<<endl;

          }

          for(int i=1;i<=n-o;i++)

          {

          for(int h=1;h<=n-o-i;h++)

          cout<<" ";

          cout<<"X";

          for(int h=1;h<=(n-o+i-n/2)*2-1;h++)

          cout<<" ";

          cout<<"X";

          cout<<endl;

          }

          return 0;

          }

          • 1

          信息

          ID
          100
          时间
          1000ms
          内存
          256MiB
          难度
          3
          标签
          递交数
          41
          已通过
          25
          上传者