1500802034吕占英

导航

爬楼梯

#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;
}

posted on 2017-03-08 11:08  心....依旧  阅读(78)  评论(0编辑  收藏  举报