hdu 4472 Count dp
来源:互联网 发布:原生js 移除class 编辑:程序博客网 时间:2024/05/16 01:07
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int N=1010;const int inf=1e9+7;int dp[N];int main(){int n;int Case=1;while(scanf("%d",&n)!=EOF){memset(dp,0,sizeof(dp));dp[1]=1;for(int i=2;i<=n;i++){for(int j=1;j<=i;j++){if((i-1)%j==0){dp[i]+=dp[j];dp[i]%=inf;}}}printf("Case %d: %d\n",Case++,dp[n]);}return 0;}对于i来说,留下一个作为boss节点,对剩下的进行排列,要求是同一层具有相同的个数,枚举相同子树上的数量j,如果j符合条件则加上dp[j],dp[j]表示j个节点所有符合条件的数量,j有不同的符合条件的子树,这里是将剩下的分成(i-1)/j个j,当一个j形状改变是,其他j同时改变,就还是符合条件的了。
0 0
- hdu 4472 Count dp
- [dp] hdu 4472 Count
- HDU-#4472 Count(DP)
- HDU 4472 - Count(计数DP)
- HDU ACM 4472 Count->DP
- hdu 4472 Count DP 递推
- HDU 4472 Count (线性dp 推公式)
- hdu 4472 Count【思维+dp】好题
- HDU 3485 Count 101(简单DP)
- HDU 3336 Count the string(KMP+dp)
- [HDU 3336]Count the String[kmp][DP]
- HDU 3336 Count the string KMP+DP
- hdu 3336 Count the string KMP+DP
- HDU 3336 Count the string kmp+dp
- HDU 3485 count 101 简单DP
- hdu -- 3336 Count the string(KMP + dp)
- hdu 3336 Count the string 【kmp + dp】
- hdu 3336 Count the string KMP+DP
- Android高效加载大图、多图解决方案,有效避免程序OOM
- 对于脉冲信号发生器的一些总结
- 重没想过好好走下去----我的IT成长路
- hdu2073(无限的路)
- IE中li标签内容水平对不齐解决办法
- hdu 4472 Count dp
- openwrt脚本启动顺序说明与添加自启动脚本
- ComputreArea
- loadrunner 11安装 (压力测试工具)
- 笔试题
- between and 时间查询
- 字符串匹配算法
- 解决容器对组件的“侵入式”管理方法之二——控制反转(Ioc)
- c:for