• 递归
#include<iostream>
#include<vector>
using namespace std;

vector<int>a(1,1);
vector<int>b(2,1);

vector<int>print(int n){
    if(n==1)return a;
    else if(n==2)return b;//n<3时直接给出
    else{  //递推
        vector<int>s=print(n-1);
        vector<int>ans;
        ans.insert(ans.begin(),1);//先放1
        for(int i=0;i<n-2;i++){
            ans.push_back(s[i]+s[i+1]);//等于前一行相邻两数之和
        }
        ans.insert(ans.end(),1);//最后放1
        return ans;
    }
} 

int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        vector<int>x=print(n);
        for(int i=0;i<x.size();i++){
            if(i==0)printf("%d",x[i]);
            else printf(" %d",x[i]);
        }
    }
    return 0;
}