7 solutions
-
1
#include<bits/stdc++.h> using namespace std; void h(int x,char a,char b,char c) { if(x==1) { cout<<a<<"->"<<x<<"->"<<b<<endl; } else { h(x-1,a,c,b); cout<<a<<"->"<<x<<"->"<<b<<endl; h(x-1,c,b,a); } } int main() { int n; char a,b,c; cin>>n>>a>>b>>c; h(n,a,b,c); return 0; }
Information
- ID
- 940
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 118
- Accepted
- 36
- Uploaded By