• 蓝桥


    #include <stdio.h>
    /*
     *J
     *L_1
     *100
     */
    int main(int argc, char *argv[])
    {
     static int a = 1,b = 1;
     int choose;
     int cycle;
     int h = 100;
     static int ans;
      scanf("%d",&choose);
      if(choose == 1||choose == 2)
      {
       printf("%d ",1);
       return 0;
      }
      for(cycle = 2;cycle < choose;cycle++)
      {
       ans = a + b;
       a = b%10007;
       b = ans%10007;
      }
      ans = ans%10007;
      printf("%d ",ans);
      ans = 0;
      a = 1;
      b = 1;
     
     return 0;
    }

    这个题目的关键在于,数据的取模。因为数据无法直接存储。

    所以只能在运算过程中处理,

    因此在数据的运算中每次都取模10007

    这样就得到结果了!!

  • 相关阅读:
    Celery
    高并发架构
    websocket
    git分支管理
    auto_ptr与shared_ptr
    UDP信号驱动IO
    TCP带外数据
    UDP广播
    获取mac地址
    char数组初始化
  • 原文地址:https://www.cnblogs.com/jiang-bei/p/10031887.html
Copyright © 2020-2023  润新知