首页 > 其他 > 详细

爬楼梯

时间:2017-03-08 13:02:48      阅读:175      评论:0      收藏:0      [点我收藏+]

#include "stdafx.h"
#include "iostream"
using namespace std;

int fibonacci(int n)
{
if (n > 2)
return fibonacci(n - 1) + fibonacci(n - 2);
else
return 1;
}
int main()
{
int data[20];
int t;
int i;
cin>>"Please input T and the nums: \n";
cin>>"%d",&t;
for (i = 0; i<t; i++)
{
cin>>"%d", &data[i];
}
cout<<"The output: \n";
for (i = 0; i<t; i++)
{
cout<<"%d\n", fibonacci(data[i] + 1);
}
return 0;
}

爬楼梯

原文:http://www.cnblogs.com/lvzhanying/p/6518421.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!