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:用dp怎么做的?In Reply To:Re:用dp怎么做的? Posted by:dhl23 at 2008-10-11 00:31:57 > #include<iostream> > using namespace std; > > int main() > { > int t,count=0,array[50][2],i,n; > array[1][0]=1; > array[1][1]=1; > for(i=2;i<=45;i++) > { > array[i][0]=array[i-1][1]+array[i-1][0]; > array[i][1]=array[i-1][0]; > } > cin>>t; > while(t--) > { > count++; > cin>>n; > cout<<"Scenario #"<<count<<":"<<endl; > cout<<array[n][0]+array[n][1]<<endl; > cout<<endl; > } > return 0; > } 可以解释一下吗?》 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator