解题思路:
注意事项:
参考代码:
#include <iostream>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <string>
#include <cmath>
#include <cstdlib>
#include <string.h>
using namespace std;
int f(int n)
{
if(n==1)
{
return 1;
}
if(n==2)
{
return 1;
}
if(n==3)
{
return 1;
}
return f(n-1)+f(n-3);
}
int main()
{
int n;
cin>>n;
cout<<f(n)<<endl;
return 0;
}
0.0分
11 人评分
最长单词 (C语言代码)浏览:1404 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:377 |
【排队买票】 (C语言代码)浏览:906 |
WU-蓝桥杯算法提高VIP-交换Easy (C++代码)浏览:1119 |
WU-字符串比较 (C++代码)浏览:766 |
三角形 (C++代码)递归(存在大量重复计算,容易出现时间超限)浏览:790 |
C语言程序设计教程(第三版)课后习题6.6 (C++代码)浏览:637 |
WU-C语言程序设计教程(第三版)课后习题12.1 (C++代码)浏览:943 |
Pascal三角 (C语言代码)浏览:664 |
C语言程序设计教程(第三版)课后习题12.5 (C语言代码)浏览:768 |