棋子移动
#include<iostream> using namespace std; int f(int n){ if(n==4){ cout<<"4,5-->9,10\n"<<"8,9-->4,5\n"<<"2,3-->8,9\n"<<"7,8-->2,3\n" <<"1,2-->7,8\n"; }else{ cout<<n<<","<<n+1<<"-->"<<2*n+1<<","<<2*n+2<<endl; cout<<2*n-1<<","<<2*n<<"-->"<<n<<","<<n+1<<endl; f(n-1); } } int main(){ int n; cin>>n; f(n); return 0; }