zoukankan      html  css  js  c++  java
  • 2013=7=23 超级阶梯

    #include <stdio.h>

    int s; int ggt(int x)

     {      if(x<1) return 0;     

        if(x==1)    return 1;        

    if(x==2)   return 2;      

      if(x==3) return 3;      

      if(x==4) return 5;     

      if(x==5) return 8;      

      if(x==6) return 13;  

        return ggt(x-1)+ggt(x-2);

    }  

    int main()

    {        int i,k,n,m,x;   

      scanf("%d",&n);   

      while(n--)   

      {         scanf("%d",&m);      

      printf("%d ",ggt(m-1));  

      } 

    }  

    #include <stdio.h>

    int s;

    int ggt(int x)

     {      if(x<1)   return 0;      

      if(x==1)   return 1;      

      if(x==2) return 2;      

      if(x==3) return 3;      

      if(x==4) return 5;     

      if(x==5) return 8;     

        if(x==6) return 13;    

    if(x==39)  return 102334155 ;   

        return ggt(x-1)+ggt(x-2); }  

    int main()

    {        int i,k,n,m,x;   

      scanf("%d",&n);    

    while(n--)   

      {       

      scanf("%d",&m);    

        printf("%d ",ggt(m-1)); 

       } 

    }

    ****************************************************** **********************************************************************

    #include <iostream>

    using namespace std;

    int main()

    {     int t,n,a[40]={0,1,2},i;    

    cin>>t;    

    while(t--)

        {      

       cin>>n;    

         for(i=3;i<=n;i++)  

               a[i]=a[i-1]+a[i-2];      

       cout<<a[n-1]<<endl;  

       }    

    return 0;

    }

    #include <iostream>

    using namespace std;

    int main()

    {    

    int t,n,a[41]={0,0,1,2},i;   

      cin>>t;   

      while(t--)    

    {    

         cin>>n;       

      for(i=4;i<=n;i++)        

         a[i]=a[i-1]+a[i-2];    

         cout<<a[n]<<endl;  

       }   

      return 0;

    }

  • 相关阅读:
    关于 TIdHttp
    DCEF3 相关资料
    WPF RichTextBox 控件常用方法和属性
    Delphi Data Type to C# Data Type
    获取 CPU 序列号
    Visual Studio 调用 Delphi DLL 会退出的解决方案
    IDHttp的基本用法(转)
    TChromeTabs 优化改进
    java与json转换
    js charAt()方法
  • 原文地址:https://www.cnblogs.com/wc1903036673/p/3209661.html
Copyright © 2011-2022 走看看