题意:给你n和k,然后找出b1, b2, ..., bl(1 ≤ b1 ≤ b2 ≤ ... ≤ bl ≤ n),并且对所有的bi+1%bi==0,问有多少这样的序列?

思路:dp[i][j] 表示长度为i,以j为结尾有多少。dp【i】【j】+=dp【i-1】【s】,j%s==0;

 #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int mod=; int n,k;
int dp[][]; int main()
{
scanf("%d%d",&n,&k);
memset(dp,,sizeof(dp));
for(int i=; i<=n; i++)
{
dp[][i]=;
}
for(int i=; i<=k; i++)
{
for(int j=; j<=n; j++)
{
for(int s=j; s<=n; s+=j)
{
dp[i][s]+=dp[i-][j];
dp[i][s]%=mod;
}
}
}
long long ans=;
for(int i=; i<=n; i++)
{
ans+=dp[k][i];
ans%=mod;
}
printf("%lld\n",ans);
return ;
}

codeforces D.Mashmokh and ACM的更多相关文章

  1. Codeforces 414B Mashmokh and ACM

    http://codeforces.com/problemset/problem/414/B 题目大意: 题意:一个序列B1,B2...Bl如果是好的,必须满足Bi | Bi + 1(a | b 代表 ...

  2. CodeForces 415D Mashmokh and ACM

    $dp$. 记$dp[i][j]$表示已经放了$i$个数字,并且第$i$个数字放了$j$的方案数.那么$dp[i][j] = \sum\limits_{k|j}^{}  {dp[i - 1][k]}$ ...

  3. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  4. codeforces 414B B. Mashmokh and ACM(dp)

    题目链接: B. Mashmokh and ACM time limit per test 1 second memory limit per test 256 megabytes input sta ...

  5. Codeforces Round #240 (Div. 1) B. Mashmokh and ACM DP

                                                 B. Mashmokh and ACM                                     ...

  6. B. Mashmokh and ACM(dp)

    http://codeforces.com/problemset/problem/414/B B. Mashmokh and ACM time limit per test 1 second memo ...

  7. codeforces 414D Mashmokh and Water Tanks

    codeforces 414D Mashmokh and Water Tanks 题意 题解 \(a_i\):第 \(i\) 层的结点个数. \(b_i\):第 \(i\) 层初始有水的结点个数. 如 ...

  8. Mashmokh and ACM CodeForces - 414D (贪心)

    大意: 给定n结点树, 有k桶水, p块钱, 初始可以任选不超过k个点(不能选根结点), 在每个点放一桶水, 然后开始游戏. 游戏每一轮开始时, 可以任选若干个节点关闭, 花费为关闭结点储存水的数量和 ...

  9. Codeforces Round #445 A. ACM ICPC【暴力】

    A. ACM ICPC time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...

随机推荐

  1. JVM类载入过程及主动引用与被动引用

    了解类载入全过程,有助于了解JVM执行过程,以及更深入了解java动态性(解热部署,动态载入),提高程序灵活性. 类载入全过程: JVM将class文件字节码文件载入到内存中.并对数据进行校验解析和初 ...

  2. Android中fragment_main.xml文件里的组件获取的问题

    package com.dhy.phonedial; import android.app.Activity; import android.app.Fragment; import android. ...

  3. thinkphp 统计某个字段不重复数 总数

    $this->batch->count('DISTINCT intobatch');

  4. 我的第一个C语言程序 (A+B Problem)(cheney-yang)

    第一个接触的C语言程序,是一个简单的A+B问题! 题目出处:http://acm.nyist.net/JudgeOnline/problem.php?pid=1 题目描述: 计算a+b的值 输入:   ...

  5. [转]C#中yield用法

    yield 关键字向编译器指示它所在的方法是迭代器块.编译器生成一个类来实现迭代器块中表示的行为.在迭代器块中,yield 关键字与 return 关键字结合使用,向枚举器对象提供值.这是一个返回值, ...

  6. super() extends() private总结demo

    public class TestService { private String name; public TestService(String name) { this.name=name; } ...

  7. iBatis 的修改一个实体

    Student.xml <update id="updateStudent" parameterClass="Student" > UPDATE S ...

  8. Get file name without extension.

    Ref:How to get file name without the extension? Normally,there are two ways to implements this:use t ...

  9. 推荐Asp.net WebApi入门教程

    Web API 强势入门指南; Web API 入门指南 - 闲话安全; 实例快速上手 -ASP.NET 4.5新特性WebAPI从入门到精通; Asp.net WebApi 项目示例(增删改查).

  10. oracle中所有关于时间日期的问题总结

    select current_date as 当前会话时间,sysdate as 系统时间, systimestamp as 系统详细时间 from dual;