zoukankan      html  css  js  c++  java
  • HDU 2044【一只小蜜蜂】

    Problem Description
    有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。
    其中,蜂房的结构如下所示。
     
    Input
    输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0<a<b<50)。
     
    Output
    对于每个测试实例,请输出蜜蜂从蜂房a爬到蜂房b的可能路线数,每个实例的输出占一行。
     
    Sample Input
    2 1 2 3 6
     
    Sample Output
    1 3
     
     1 #include<stdio.h>
     3 int main()
     5 {
     7   int n;
     9    __int64 f[55];
    11   f[1]=1;
    13   f[2]=1;
    15   for(int i=3;i<55;i++)
    17   {
    19     f[i]=f[i-1]+f[i-2];
    21   }
    22   while(n--)
    25     {
    27       int a,b;
    28 
    29       scanf("%d%d",&a,&b);
    30 
    31       printf("%I64d
    ",f[b-a+1]);
    32 
    33     }
    34 
    35 return 0;
    36 
    37 }
    我愿付出努力,只为更好的明天
  • 相关阅读:
    SpringBoot整合阿里云OSS
    UVALive
    HDU 5794 A Simple Chess dp+Lucas
    数论
    UVALive
    UVALive
    HDU 5792 World is Exploding 树状数组+枚举
    UVALive
    UVALive
    UVALive
  • 原文地址:https://www.cnblogs.com/castledrv/p/3667076.html
Copyright © 2011-2022 走看看