| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
超时啊!!!!!!!!!那位大虾帮帮,看看出了什么问题代码:
#include "iostream.h"
int fib(int t);
int main()
{
int i;
while (cin>>i)
{
int a[10000];
for(int k=0;k<i;k++)
{
cin>>a[k];
cout<< "Scenario #"<<k+1<<' '<<":"<<endl;
cout<<fib(a[k])<<endl;
}
}
return 0;
}
fib(int t)
{
if(t==1)return 2;
else if(t==2)return 3;
else
return (fib(t-1)+fib(t-2));
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator