http://codeforces.com/problemset/problem/414/B

题目大意:

题意:一个序列B1,B2...Bl如果是好的,必须满足Bi | Bi + 1(a | b 代表a整除b), 求长度为K,元素大小小于等于N的序列个数

思路:f[i][j] 代表在序列的第i位,当前数字为j的方案数

 #include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
const int Mod=;
int f[][];
int n,K;
int read(){
int t=,f=;char ch=getchar();
while (ch<''||ch>''){if (ch=='-') f=-;ch=getchar();}
while (''<=ch&&ch<=''){t=t*+ch-'';ch=getchar();}
return t*f;
}
int main(){
n=read();K=read();
for (int i=;i<=n;i++)
f[][i]=;
for (int i=;i<=K;i++)
for (int j=;j<=n;j++){
for (int k=;k<=sqrt(j);k++)
if (j%k==){
f[i][j]=(f[i][j]+f[i-][k])%Mod;
if (k*k!=j)
f[i][j]=(f[i][j]+f[i-][j/k])%Mod;
}
}
int ans=;
for (int i=;i<=n;i++)
ans=(ans+f[K][i])%Mod;
printf("%d\n",ans);
return ;
}

Codeforces 414B Mashmokh and ACM的更多相关文章

  1. codeforces D.Mashmokh and ACM

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

  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. CF 414B Mashmokh and ACM 动态规划

    题意: 给你两个数n和k.求满足以下条件的数列有多少个. 这个数列的长度是k: b[1], b[2], ……, b[k]. 并且 b[1] <= b[2] <= …… <= b[k] ...

  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 415D】Mashmokh and ACM(普通dp)

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

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

                                                 B. Mashmokh and ACM                                     ...

  7. B. Mashmokh and ACM(dp)

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

  8. codeforces 414D Mashmokh and Water Tanks

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

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

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

随机推荐

  1. 多线程操作UI界面的示例 - 更新进度条

    http://blog.csdn.net/liang19890820/article/details/52186626

  2. qt http 上传文件

    //Qt文件 QFile file("1.jpg"); if(!file.open (QIODevice::ReadOnly)){     qDebug()<<&quo ...

  3. 关于老驱动不能在windows 8下正常安装的问题

    问题: 老驱动(WDF),能在windows 7下安装并工作,但是不能在windows 8下安装. 先了解下windows 8驱动的新东西吧: New for windows 8 http://msd ...

  4. JVM JMM

  5. Linux企业级项目实践之网络爬虫(22)——编写爬虫系统服务控制脚本

    需求:1.可通过 service spider start|stop|status|restart 命令对服务进行控制2.spider服务可开机自启动 start() { echo "sta ...

  6. AIR检测网络

    package com.juyou.util.net { import flash.events.StatusEvent; import flash.net.URLRequest; import ai ...

  7. c#秒转时分秒

          2个办法 @{             int hour = item.track / 3600;             int min = (item.track - hour * 3 ...

  8. openStack kilo 手动Manual部署随笔记录

    一 ,基于neutron网络资源主机(控制节点,网络节点,计算节点)网络规划配置 1, controller.cc 节点 网络配置截图

  9. 360网站卫士常用前端公共库CDN服务

    360网站卫士常用前端公共库CDN服务 360网站卫士常用前端公共库CDN服务

  10. poj1011 Sticks(dfs+剪枝)

    Sticks Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 110416   Accepted: 25331 Descrip ...