#include<iostream>
using namespace std;
int A[4][7]={{0},{4,11,3,2,1,0,0},{1,11,0,0,0,0,0},{1,11,0,0,0,0,0}};
void show()
{
//for(int i=1;i<=3;i++){ for(int j=0;j<7;j++) cout<<A[i][j]<<" ";cout<<endl;}
cout<<"---------------------- "<<endl;
for(int i=6;i>0;i--)
{
for(int j=1;j<4;j++)
{
if(A[j][i]==0)cout<<" ";
if(A[j][i]==1)cout<<" [1] ";
if(A[j][i]==2)cout<<" [ 2 ] ";
if(A[j][i]==3)cout<<" [ 3 ] ";
if(A[j][i]==4)cout<<" [ 4 ] ";
if(A[j][i]==5)cout<<" [ 5 ] ";
if(A[j][i]==11)cout<<"[-------------------------]";
}
cout<<endl;
}
}
void play()
{
int m,n;
show();
cout<<" enter m to n "<<endl;
cin>>m>>n;
if(m==n)play();
if(1>m||m>3||1>n||n>3)play();
if(A[m][A[m][0]]<A[n][A[n][0]])
{
A[n][0]++;
A[n][A[n][0]]=A[m][A[m][0]];
A[m][A[m][0]]=0; A[m][0]--;
}
play();
}
int main()
{
play();
return 0;
}
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。