0分求助!!!
查看原帖
0分求助!!!
665234
hqc111楼主2022/11/13 10:06
#include<bits/stdc++.h>
using namespace std;
int n;
char ch[250];
void output(){
     for(int i=0;i<2*n+2;i++)cout<<ch[i];
	cout<<endl;
} 
void movechess(int s,int e){
     swap(ch[s],ch[e]);
     swap(ch[s+1],ch[e+1]);
     output();
}
string out[5]={"ooo--***o*",
               "o--*o**oo*",
               "o*o*o*--o*",
			   "--o*o*o*o*"};               
int main(){
    cin>>n;
    for(int i=0;i<n;i++)ch[i]='o',ch[i+n]='*';
	ch[2*n]=ch[2*n+1]='-';
	output();
	int len=n;
	while(len>4){
	    movechess(len-1,2*len);
		movechess(len-1,2*len-2);
		len--;  
	}
	string ss="";
	for(int i=4;i<n;i++) 
	    ss+="o*";
	for(int i=0;i<5;i++){
	    cout<<out[i]<<ss<<endl;
	}    	 
   return 0; 
}

/0分求助

2022/11/13 10:06
加载中...