记录程序(递归考试第二题

ykj12 2022-05-29 16:27:47 2022-05-29 16:28:11 0
#include<bits/stdc++.h>
#define N 10000
using namespace std;
int a[N];
void f(int n){
	if(n==2){
		cout<<1<<" "<<n<<" "<<1<<" ";
		return;
	}
	f(n-1);
	cout<<n<<" ";
	f(n-1);
}
int main(){
	freopen("xl.in","r",stdin);
	freopen("xl.out","w",stdout);
	int n;
	cin>>n;
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	f(n);
	return 0;
}

序列(oj上没有 AC了

{{ vote && vote.total.up }}