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

献上我的第一次

Posted by z1160y at 2009-06-11 15:11:20 on Problem 1221
#include <iostream>
using namespace std;
int main()
{
	__int64 dp[250][250];
	int i,j;
	for(i=0;i<250;i++)  
	{ 
		for(j=0;j<250;j++)
		{
			if(i*j==0||i==j)  dp[i][j]=1;
			else dp[i][j]=0;
	//		printf("%I64d",dp[i][j]);
		}
	}
	for(i=2;i<250;i++)
	{
		for(j=i-1;j>=1;j--)
		{
			if(i>=2*j)  dp[i][j]=dp[i][j+1]+dp[i-2*j][j];
			else dp[i][j]=dp[i][j+1];
		}
	}
	int n;
	while(cin>>n&&n)
	{
		printf("%d %I64d\n",n,dp[n][1]);
	}
	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