解题思路:
注意事项:
参考代码:
#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语言程序设计教程(第三版)课后习题9.2 (C语言代码)浏览:687 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:632 |
【回文数(二)】 (C语言代码)浏览:851 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:1028 |
c primer plus 第十二章 12.1小节浏览:376 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:654 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:664 |
P1000 (C语言代码)浏览:868 |
1024题解浏览:806 |
蓝桥杯历届试题-翻硬币 (C++代码)浏览:872 |