#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{int c1[1005],c2[1005];int i,j,k;int n;while(scanf("%d",&n)!=EOF){memset(c1,0,sizeof(c1));memset(c2,0,sizeof(c2));for(i=0;i<=n;i++)//第一个括号内的所有数目 c1[i]=1;//代表第一个括号里的所有系数标为一 for(i=2;i<=n;i++){for(j=0;j<=n;j++)for(k=0;k+j<=n;k+=i)c2[j+k]+=c1[j];for(j=0;j<=n;j++)c1[j]=c2[j],c2[j]=0; } printf("%d\n",c1[n]);} return 0;
}
详细解决方案
HDU Ignatius and the Princess III
热度:67 发布时间:2023-12-05 06:27:07.0
相关解决方案
- HDOJ 1029 Ignatius and the Princess IV
- UVA - 10635 Prince and Princess (求LIS)
- HDU Ignatius and the Princess III
- [Interview Street] Track 1 - Bot saves princess - 2
- 例题27 UVa10635 Prince and Princess(DP:LIS的nlogn算法)
- HDU1028 Ignatius and the Princess III(整数拆分:母函数||DP)
- HDU4689 Prince and Princess (Tarjan+匈牙利匹配)