5 条题解

  • 1
    @ 2020-09-16 22:46:21

    #python3

    n=int(input())
    while(1):
        if n<1 or n>24:
            n=int(input())
        else:
            break
    
    b=((1+5**0.5)/2)**n
    c=((1-5**0.5)/2)**n
    d=(5**0.5)
    a=(b-c)/d
    print(int(a))
    
    
    
  • 0
    @ 2021-02-05 19:08:01

    fib数列。。

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n,c,a=1,b=1,i=3;
        cin>>n;
        while(i<=n)
        {
            c=a+b;
            a=b;
            b=c;
            i++;
        }
        if(n==2||n==1)
            cout<<"1";
    //  printf("%d",c);
        else
            cout<<c;
        return 0;
    }
    
  • 0
    @ 2020-08-18 16:29:14
    n=int(input())
    def fib(n):
        if n==1:
            return 1
        if n==2:
            return 1
        return fib(n-2)+fib(n-1)
    print(fib(n))
    
    
  • 0
    @ 2019-04-19 19:53:36

    a=int(input())
    b=0
    c=0
    list=[1,1]
    while b<a:
    d=list[b]+list[b+1]
    b=b+1
    list.append(d)
    print(list[a-1])

  • 0
    @ 2019-04-19 14:40:57
    n=int(input())
    a=1
    b=1
    c=0
    if n==1 or n==2:
        print(1)
    else:
        n-=2
        while(n):
            n-=1
            c=b
            b+=a
            a=c
        print(b)
    
  • 1

信息

难度
4
分类
(无)
标签
(无)
递交数
249
已通过
105
通过率
42%
被复制
1
上传者