思路:dp[i][j]表示和为i,最大值为j的方案数。

 #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define maxn 100010
#define ll long long
using namespace std;
const int mod=; int n,k,d;
ll dp[][]; int main()
{
scanf("%d%d%d",&n,&k,&d);
for(int i=; i<=n; i++)
{
dp[i][i]=;
}
for(int i=; i<=n; i++)
{
for(int j=; j<=k; j++)
{
for(int x=; x<=k; x++)
{
if(j>=x)
{
dp[i+j][j]+=dp[i][x];
dp[i+j][j]%=mod;
}
else
{
dp[i+j][x]+=dp[i][x];
dp[i+j][x]%=mod;
}
}
}
}
ll ans=;
for(int i=d; i<=k; i++)
{
ans+=dp[n][i];
ans%=mod;
}
printf("%lld\n",ans);
return ;
}

codeforces C. k-Tree的更多相关文章

  1. Codeforces 343D Water Tree(DFS序 + 线段树)

    题目大概说给一棵树,进行以下3个操作:把某结点为根的子树中各个结点值设为1.把某结点以及其各个祖先值设为0.询问某结点的值. 对于第一个操作就是经典的DFS序+线段树了.而对于第二个操作,考虑再维护一 ...

  2. Problem - D - Codeforces Fix a Tree

    Problem - D - Codeforces  Fix a Tree 看完第一名的代码,顿然醒悟... 我可以把所有单独的点全部当成线,那么只有线和环. 如果全是线的话,直接线的条数-1,便是操作 ...

  3. codeforces 570 D. Tree Requests 树状数组+dfs搜索序

    链接:http://codeforces.com/problemset/problem/570/D D. Tree Requests time limit per test 2 seconds mem ...

  4. codeforces 375D:Tree and Queries

    Description You have a rooted tree consisting of n vertices. Each vertex of the tree has some color. ...

  5. Codeforces gym102152 K.Subarrays OR

    传送:http://codeforces.com/gym/102152/problem/K 题意:给定$n(n\le10^5)$个数$a_i(a_i\le10^9)$,对于任一个子数组中的数进行或操作 ...

  6. Codeforces 765 E. Tree Folding

    题目链接:http://codeforces.com/problemset/problem/765/E $DFS子$树进行$DP$ 大概分以下几种情况: 1.为叶子,直接返回. 2.长度不同的路径长度 ...

  7. codeforces 1133E K Balanced Teams

    题目链接:http://codeforces.com/contest/1133/problem/E 题目大意: 在n个人中找到k个队伍.每个队伍必须满足最大值减最小值不超过5.求满足条件k个队伍人数的 ...

  8. Codeforces 932.D Tree

    D. Tree time limit per test 2 seconds memory limit per test 512 megabytes input standard input outpu ...

  9. Codeforces 375 D Tree and Queries

    Discription You have a rooted tree consisting of n vertices. Each vertex of the tree has some color. ...

  10. CodeForces 383C Propagating tree

    Propagating tree Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces ...

随机推荐

  1. Annotation Type @bean,@Import,@configuration使用--官方文档

    @Target(value={METHOD,ANNOTATION_TYPE}) @Retention(value=RUNTIME) @Documented public @interface Bean ...

  2. java Permissions and Security Policy--官方文档

    3 Permissions and Security Policy 3.1 The Permission Classes The permission classes represent access ...

  3. [转] 学习React Native必看的几个开源项目

    http://www.lcode.org/study-react-native-opensource-one/ http://gold.xitu.io/entry/575f498c128fe10057 ...

  4. [iOS 开发] app无法访问本地相册,且不显示在设置 -隐私 - 照片中

    近几天在使用iOS8的Photos Framework访问本地相册时,app即不会弹出是否允许访问提示框,也无法显示在iPhone的设置-隐私-照片的访问列表中,代码如下: PHAuthorizati ...

  5. javascript新的原生态API

    以下是最新的w3c标准的javascript,目前支持运行在firefox, chrome,IE9以上版本的浏览器 参考资料:https://developer.mozilla.org/ru/docs ...

  6. oracle数组定义与使用

    定义固定长度的一维数组 type type_array is varray(10) of varchar2(20); 1.varray(10)表示定义长度为10的数组 2.varchar2(20)表示 ...

  7. HTML5之填写个人信息

  8. Java多线程——其他工具类CyclicBarrier、CountDownLatch和Exchange

    CyclicBarrier 适用于:创建一组任务,它们并行地执行任务,然后在进行下一个步骤之前等待,直至所有任务完成.它使得所有的并行任务都将在栅栏处列队,因此可以一致地向前移动. 表示大家彼此等待, ...

  9. 转--Oracle DB 服务器系统时间修改问题与 SCN 关系的深入研究

    论坛里一个朋友说将DB 服务器系统时间往往后修改了3个月(从11年改成10年),启动DB报600的错误. 一. 先做个测试 1.1 关闭DB SQL> shutdown immediate Da ...

  10. VB中右键换行

    /r/n  能在邮件中进行换行, 在VB中使用 ASCII码的 chr(10).chr(13) 就能使VB发送邮件实现换行