HDU 1028 - Ignatius and the Princess III

居然是DP..

#include <iostream>
using namespace std;
int dp[125],n;
int main()
{
    dp[0]=1;
    for(int i=1;i<=120;i++)
    {
        for(int j=i;j<=120;j++)
        {
            dp[j]+=dp[j-i];
        }
    }
    while(~scanf("%d",&n))
    {
        printf("%d\n",dp[n]);
    }
}

 

posted @ 2016-04-29 14:34  nicetomeetu  阅读(94)  评论(0编辑  收藏  举报