提交时间:2023-11-14 20:39:58

运行 ID: 31070

#include<iostream> #include<cmath> using namespace std; int h(int n,char a,char b,char c){ if(n==1){ printf("%c->%d->%c\n",a,n,b); return 0; } h(n-1,a,b,c); printf("%c->%d->%c\n",a,n,b); h(n-1,a,b,c); } int main() { int n; char a,b,c; cin>>n>>a>>b>>c; h(n,a,c,b); }