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 |
70题,wa一次。#include<iostream> #define MAX 50 using namespace std; int fn[MAX][MAX]; int main() { int nums; cin>>nums; for(int i=0;i<nums;i++) { int len; cin>>len; memset(fn,0,sizeof(fn)); fn[1][0] = 1; fn[1][1] = 1; for(int j = 2;j<=len;j++) { fn[j][0]+=fn[j-1][0]+fn[j-1][1]; fn[j][1]+=fn[j-1][0]; } cout<<"Scenario #"<<i+1<<":"<<endl; cout<<fn[len][0]+fn[len][1]<<endl<<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