| ||||||||||
| 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 | |||||||||
献上我的第一次#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator