首页 > 其他 > 详细

Jav实现F(n)=F(n-1)+F(n-2)+.....+F(1)+1

时间:2017-08-16 14:43:02      阅读:543      评论:0      收藏:0      [点我收藏+]

private static int func(int count) {
  // TODO Auto-generated method stub
  int cou = 0;
  if(count==1){
   cou=1;
  }
  else if(count==2){
   cou=2;
  }
  else{
   for(int i=1;i<count;i++){
    cou+=func(count-i);
   }
   cou=cou+1;
  }
  return cou;
 }

Jav实现F(n)=F(n-1)+F(n-2)+.....+F(1)+1

原文:http://www.cnblogs.com/blythe/p/7373107.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!