トピック:
分析:移動プロセスが与えられたので、問題は簡単です。振り返ってください。
コード:
#include<bits/stdc++.h>
using namespace std;
string s;
int m;
void init()
{
string s1(m,'o');
string s2(m,'*');
s=s1+s2;
s+='-';s+='-';
}
void f(int x1,int x2,int y1,int y2)
{
if(y2==9) return;
cout<<s<<endl;
s[x1]='-';
s[x2]='-';
s[y1]='o';
s[y2]='*';
cout<<s<<endl;
if(x1==0) return;
s[x1]='*';
s[x2]='*';
s[y1-2]='-';
s[y2-2]='-';
x1--;
x2--;
y1--;y1--;y2--;y2--;
f(x1,x2,y1,y2);
}
void f2()
{
cout<<"oooo****--";
cout<<s.substr(10,s.length()-10)<<endl;
cout<<"ooo--***o*";
cout<<s.substr(10,s.length()-10)<<endl;
cout<<"ooo*o**--*";
cout<<s.substr(10,s.length()-10)<<endl;
cout<<"o--*o**oo*";
cout<<s.substr(10,s.length()-10)<<endl;
cout<<"o*o*o*--o*";
cout<<s.substr(10,s.length()-10)<<endl;
cout<<"--o*o*o*o*";
cout<<s.substr(10,s.length()-10)<<endl;
}
int main()
{
cin>>m;
init();
f(m-1,m,m+m,m+m+1);
f2();
}