社区讨论
0分求助!!!
P1259黑白棋子的移动参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @lo7k5qm3
- 此快照首次捕获于
- 2023/10/27 03:09 2 年前
- 此快照最后确认于
- 2023/10/27 03:09 2 年前
CPP
#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分求助
回复
共 2 条回复,欢迎继续交流。
正在加载回复...