N-Ring is a game, in which N rings are put on a stick in order, and every rings are effected by each other following the rules below:
Our goal is to take off all the rings.
Hint: You can implement the following code we provided
#include<stdio.h>
void in(int);
void out(int n){
// take off the first n rings
}
void in(int n){
//put on the first n rings
}
int n;
int main(){
scanf("%d",&n);
out(n);
return 0;
}
Given an integer N, 1 <= N <= 18, meaning there are N rings.
Output the answer of N-Rings in order.
“Move ring n out” means taking the n-th ring off the stick.
“Move ring n in” means putting the n-th ring on the stick.