http://acm.hdu.edu.cn/showproblem.php?pid=2044 一只小蜜蜂... Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 35811 Accepted Submission(s): 1317
一只小蜜蜂... Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 59284 Accepted Submission(s): 21462 Problem Description 有一只经过训练的蜜蜂只能爬向右侧
HDU2044 题意:如图 思路:从终点判,蜜蜂每次只能从前1个蜂房或者前2个蜂房过来所以:dp[i]=dp[i-1]+dp[i-2];再数出终点和起点相差的格子数为b-a+1,记得开longlong。 #include<bits/stdc++.h>#define int long long using namespace std;signed main(){int t,dp[50]