题意:
有多少个n个节点的有根树,满足每层节点的子节点个数相同,输出该数目除以1e9+7的余数。
分析:
这种题目就属于那种,看起来很高冷,读完题更高冷。
言归正传,根据题意,这棵树是关于根节点对称的,对称性非常好,根节点下面的子树也完全相同。
所以就有了如下递推关系:
// Created by Chenhongwei in 2015.
// Copyright (c) 2015 Chenhongwei. All rights reserved.
#include "iostream"
#include "cstdio"
#include "cstdlib"
#include "cstring"
#include "climits"
#include "queue"
#include "cmath"
#include "map"
#include "set"
#include "stack"
#include "vector"
#include "sstream"
#include "algorithm"
using namespace std;
const int inf=1e8;
const int maxn=1e5;
const int mod=1e9+7;
typedef long long ll;
int dp[1100];
int main()
{
//ios::sync_with_stdio(false);
// freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
memset(dp,0,sizeof dp);
dp[1]=dp[2]=1;
dp[3]=2,dp[4]=3;
for(int i=5;i<=1005;i++)
for(int j=1;j<=i-1;j++)
if((i-1)%j==0)
dp[i]+=dp[j],dp[i]%=mod;
int n,kase=0;
while(~scanf("%d",&n))
printf("Case %d: %d\n",++kase,dp[n]);
return 0;
}