摘要

题目链接 难度等级 完成状态 完成分数 最后编辑时间 需要注意
递归第一次 ★☆☆☆☆ 答案正确 100 2014-10-11 12:23:03

题意

给出递推式,求解。

题解

简单递归。

代码

1842.cpp代码已折叠
展开折叠内容
显示/移除行号
  1. #include<iostream>
  2. const int f(const int &x)
  3. {
  4. return (x>=0)?5:(f(x+1)+f(x+2)+1);
  5. }
  6. int main()
  7. {
  8. int n;
  9. std::cin>>n;
  10. std::cout<<f(n);
  11. return 0;
  12. }

著作权声明[编辑]

关于[编辑]