zoukankan      html  css  js  c++  java
  • 140725暑期培训.txt

    1、若须要使用64位int
      定义  __64int
      类型  %I64d
    2、Fibbonacci 数列  採用递归的方法
       int  F(int  n)
       {
           if(n==1||n==2)
           return  1;
           else
           return  F(n-1)+F(n-2);
       }
       void  main()
       {
           .........
       }
           在用递归算法时一定要找准《边界条件》和《递归方程》
    3、例:
         #include<stdio.h>
         int main()
         {
             int n,m;
             int i;
             int s[50];
             s[0]=0;              --------------   对于这一部分       
             s[1]=1;              --------------   由于以下运算每次都要用到
             for(i=2;i<50;i++)    --------------   所以直接写在外面
                 s[i]=s[i-1]+s[i-2];    --------   每次直接调用就可以
             scanf("%d",&n);                       这样能够省去时间。避免超时
             while(n--)
             {
                 scanf("%d",&m);
                 printf("%d ",s[m]);
             }
             return 0;
         }

  • 相关阅读:
    java.lang.UnsupportedOperationException: Not supported by BasicDataSource
    c# seo 百度sitemap书写
    c# 泛型原理(旧)
    apache 服务器配置常用知识点合集
    sass 基本常识
    c# TryParse
    webpack 配置热更新
    c# ref和out 详解
    IIS applicationHost.config 查找历史
    c# webapi 自定义返回数据
  • 原文地址:https://www.cnblogs.com/liguangsunls/p/6723864.html
Copyright © 2011-2022 走看看