Code Monkey home page Code Monkey logo

algorithms's People

Contributors

siflaneur avatar

Stargazers

 avatar  avatar  avatar

Forkers

danielfenghk

algorithms's Issues

A上楼梯时,B 从同一楼梯往下走。

coding=utf-8

"""
#背景:A上楼梯时,B 从同一楼梯往下走。每次不一定只走 1 级,最多可 以一次跳过 3 级(即直接前进 4 级)。 但无论走多少级,1 次移动所需时间不变。两人同时开始走,求共 B
有多少种“两人最终同时停在同一级” 的情况(假设楼梯宽度足够,可以相互 错开,不会撞上。另外,同时到达同一
级时视为结束)。
#问题:求当存在 10 级楼梯,且移动规则相同时,有多少种两人最终同时停在同一 级的情况?
"""
这题我怎么也算不出来能走201步:
我的走法如下:一共才14步。
步,走一步,次数,上下走的步数。
|1 | 1| 1 : <1> + <9>
|2 | 1| 2 : <2> + <8>
|3 | 1| 3 : <3> + <7>
|4 | 1| 4 : <4> + <6>
|5 | 1| 5 : <5> + <5>
|6 | 1| 6 : <6> + <4>
|7 | 1| 7 : <7> + <3>
|8 | 1| 8 : <8> + <2>
|9 | 1| 9 : <9> + <1>
|10 | 2| 1 : <2> + <8>
|11 | 2| 2 : <4> + <6>
|12 | 2| 3 : <6> + <4>
|13 | 2| 4 : <8> + <2>
|14 | 5| 1 : <5> + <5>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.