| ||||||||||
| 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 | |||||||||
Re:超时啊!!!!!!!!!那位大虾帮帮,看看出了什么问题In Reply To:超时啊!!!!!!!!!那位大虾帮帮,看看出了什么问题 Posted by:19850317 at 2007-08-28 17:27:45 > 代码:
> #include "iostream.h"
> int fib(int t);
int biao[50]={0};
> 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(biao[t]!=0) return biao[t];
> if(t==1)return biao[1]=2;
> else if(t==2)return biao[2]=3;
> else
> return biao[t]=(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