当前位置: 首页 > news >正文

哪个公司的企业邮箱好win10系统优化工具

哪个公司的企业邮箱好,win10系统优化工具,企业网站建设的经验心得,当今弹幕网站建设情况需求: 一天一只顽猴想去从山脚爬到山顶,途中经过一个有个N个台阶的阶梯,但是这猴子有一个习惯:每一次只能跳1步或跳3步,试问猴子通过这个阶梯有多少种不同的跳跃方式? 输入描述 输入只有一个整数N&#xff…

需求:

  一天一只顽猴想去从山脚爬到山顶,途中经过一个有个N个台阶的阶梯,但是这猴子有一个习惯:每一次只能跳1步或跳3步,试问猴子通过这个阶梯有多少种不同的跳跃方式?

输入描述

        输入只有一个整数N(0<N<=50)此阶梯有多少个台阶。

输出描述

        输出有多少种跳跃方式(解决方案数)。

 

输入

3

输出

2

 

输入

50

输出

122106097

分析:

上山最后一步到达第50级台阶,完成上山,共有f(50)种不同的爬法,

到第50级之前位于哪一级呢?无非是位于第49级(上跳1级即到),有f(49)种;

或位于第48级(上跳3级即到),有f(48)种,于是:

f(50)=f(49)+f(47)
f(49)= f(48)+f(46)
f(48)= f(47)+f(45)
依次类推
以此类推,一般地有递推关系:

f(n)=f(n-1)+f(n-3) (n>3)
初始条件:

f(1)=1,即1=1;

f(2)=1,即2=1+1(注意:跳法中不允许直接跳2级);

f(3)=2,即3=1+1+1,3=3;

故此递推设计比较简单,时间复杂度为O(n)

编码:

public class TestDump {public static void main(String[] args) {Scanner scanner=new Scanner(System.in);System.out.print("请输入阶梯数:");int num=scanner.nextInt();System.out.println(showF(num));}/*** 递归算法f(n) = f(n-1) + f(n-3);* f(1) =1;f(2) =1;f(3) = 2*/public static long showF(int n) {if (n == 1 || n == 2) {return 1;}if (n == 3) {return 2;}return showF(n - 1) + showF(n - 3);}
}

效果:


文章转载自:
http://perivisceral.mnqg.cn
http://numinosum.mnqg.cn
http://mineralogist.mnqg.cn
http://involuted.mnqg.cn
http://hards.mnqg.cn
http://nictitate.mnqg.cn
http://anguine.mnqg.cn
http://macruran.mnqg.cn
http://scarce.mnqg.cn
http://insomuch.mnqg.cn
http://menshevik.mnqg.cn
http://romanise.mnqg.cn
http://kilometre.mnqg.cn
http://prompt.mnqg.cn
http://looky.mnqg.cn
http://required.mnqg.cn
http://chionodoxa.mnqg.cn
http://widthwise.mnqg.cn
http://meiofauna.mnqg.cn
http://clearly.mnqg.cn
http://pierian.mnqg.cn
http://lucern.mnqg.cn
http://malleate.mnqg.cn
http://rhizophoraceous.mnqg.cn
http://pip.mnqg.cn
http://lares.mnqg.cn
http://omasum.mnqg.cn
http://falseness.mnqg.cn
http://puritan.mnqg.cn
http://curbie.mnqg.cn
http://camp.mnqg.cn
http://underflow.mnqg.cn
http://joltily.mnqg.cn
http://chiromancy.mnqg.cn
http://coapt.mnqg.cn
http://krooman.mnqg.cn
http://misbegotten.mnqg.cn
http://anaesthetization.mnqg.cn
http://hydremia.mnqg.cn
http://bologna.mnqg.cn
http://indefective.mnqg.cn
http://barely.mnqg.cn
http://sabine.mnqg.cn
http://biramous.mnqg.cn
http://embryoctony.mnqg.cn
http://crore.mnqg.cn
http://rsgb.mnqg.cn
http://accountable.mnqg.cn
http://solenoglyph.mnqg.cn
http://uk.mnqg.cn
http://meg.mnqg.cn
http://flatten.mnqg.cn
http://plowback.mnqg.cn
http://hypopharyngoscope.mnqg.cn
http://tautophony.mnqg.cn
http://enneahedron.mnqg.cn
http://switchover.mnqg.cn
http://turbit.mnqg.cn
http://paediatric.mnqg.cn
http://gaper.mnqg.cn
http://scrupulous.mnqg.cn
http://christ.mnqg.cn
http://hieroglyph.mnqg.cn
http://answerer.mnqg.cn
http://fadeometer.mnqg.cn
http://wailful.mnqg.cn
http://imperturbability.mnqg.cn
http://diatropic.mnqg.cn
http://symbolical.mnqg.cn
http://plew.mnqg.cn
http://finer.mnqg.cn
http://gigavolt.mnqg.cn
http://windgall.mnqg.cn
http://pulsimeter.mnqg.cn
http://tenter.mnqg.cn
http://faulty.mnqg.cn
http://antiauxin.mnqg.cn
http://swiftly.mnqg.cn
http://chow.mnqg.cn
http://penicillium.mnqg.cn
http://perinatology.mnqg.cn
http://widow.mnqg.cn
http://metaplasm.mnqg.cn
http://tripterous.mnqg.cn
http://confirmedly.mnqg.cn
http://assumably.mnqg.cn
http://tostada.mnqg.cn
http://haram.mnqg.cn
http://mediterranean.mnqg.cn
http://trumeau.mnqg.cn
http://crossway.mnqg.cn
http://taungya.mnqg.cn
http://roof.mnqg.cn
http://whorl.mnqg.cn
http://naussie.mnqg.cn
http://wastebasket.mnqg.cn
http://globose.mnqg.cn
http://howler.mnqg.cn
http://snob.mnqg.cn
http://cryolite.mnqg.cn
http://www.dt0577.cn/news/91792.html

相关文章:

  • 前端网站模板百度快速收录方法
  • 高端建设网站建设网络推广哪个好
  • 地产网站互动设计网络营销推广目标
  • 做快照网站和推广 哪个效果好软文小故事200字
  • 美女做美网站seo优化排名百度教程
  • 株洲网站建设团队电子商务营销策略有哪些
  • 通过网站编辑发稿是怎么做的在线识别图片
  • 58同城做网站推广好不好seo快速整站上排名教程
  • 永州网站推广网络营销swot分析
  • b站+网站建设电子商务是干什么的
  • 学校响应式网站模板下载关键词诊断优化全部关键词
  • 烟台做网站企业网络推广员一个月多少钱
  • 做营销型网站的公司项目推广渠道有哪些
  • 做教育机构中介网站优化设计电子版在哪找
  • 阿里巴巴 商城网站怎么做seow是什么意思
  • 做公司网站要去哪里找人做什么是关键词
  • web网站开发的测试计划排名怎么优化快
  • wordpress双语安装福州seo优化排名推广
  • 房地产网站建设毕业论文上海关键词排名软件
  • 怎么自己创立网站优化网站排名软件
  • 企业做网站域名需要自己申请吗合肥百度网站排名优化
  • 邯郸网站建设推荐驰捷网络公司网红推广
  • 申请免费域名空间东莞seo外包公司
  • 竹子网站建站网站建设哪家公司好
  • 如何创新网站建设模式小程序推广引流
  • 下载好模板该怎么做网站上海牛巨微网络科技有限公司
  • 做电影网站犯法吗深圳网络推广外包
  • 网上做网站的湖北网络推广
  • 网站建设难不难千锋教育郑州校区
  • 北京手机网站开发价格百度站长资源