Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

70题,wa一次。

Posted by zpdlut at 2010-09-02 09:25:22 on Problem 1953
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator