Hdu2018 母牛的故事

来源:互联网 发布:下载软件管理器 编辑:程序博客网 时间:2024/05/16 06:08
#include <iostream>
#include <algorithm>
using namespace std;


int f(int x){
    if(x<=4){
        return x;
    }
    if(x>4){
        return f(x-1)+f(x-3);
    }
}
int main()
{
    int b;
    while(cin>>b&&b){
        cout<<f(b)<<endl;
    }
    return 0;
}
原创粉丝点击