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. [转]RegOpenKeyEx函数失败的问题

    在使用这个函数RegOpenKeyEx的时候,老是执行不成功,函数本身返回2,GetLastError返回0.在CSDN上查阅资料说是返回2的原因是注册表中对应路径不存在,可是我电脑中注册表那个键值明 ...

  2. ubuntu scp

    一.将本机文件复制到远程服务器上 scp -r /Users/Dreamover/Desktop/jsnone dreamover@localserver:/var/www/project/ /Use ...

  3. 关于bootstrap--排版(标题、强调、背景、插入符等)

    1. 2.标题:<h1>这是主标题<small>这是副标题,为当前字号65%,灰色(#999)</small></h1>. 3.段落:<p> ...

  4. php字符串常用处理函数(数组的拆分、查找替换)

    //字符串常用函数    $a = "hello";    echo strlen($a); //输出字符串的长度        $b = "Hello";   ...

  5. <php>统计目录数和文件数

    $dirn = 0; //目录数 $filen = 0; //文件数 //用来统计一个目录下的文件和目录的个数 function getdirnum($file) { global $dirn; gl ...

  6. 第34讲 UI组件之 ProgressDialog和Message

    第34讲UI组件之 ProgressDialog和Message 1.进度对话框 ProgressDialog <1>简介 ProgressDialog是AlertDialog类的一个扩展 ...

  7. [RxJS] Changing Behavior with MapTo

    You often need streams to trigger different behaviors on the data based on which streams triggers. T ...

  8. [ES6] Generators

    Example 1: function *topicList(){ yield "ES2015"; yield "Semi-colons: good or bad?&qu ...

  9. 【Android 应用开发】 ActionBar 样式详解 -- 样式 主题 简介 Actionbar 的 icon logo 标题 菜单样式修改

    作者 : 万境绝尘 (octopus_truth@163.com) 转载请著名出处 : http://blog.csdn.net/shulianghan/article/details/3926916 ...

  10. Linux 时间同步配置(转)

    一. 使用ntpdate 命令 1.1 服务器可链接外网时 # crontab -e 加入一行: */1 * * * * ntpdate 210.72.145.44 210.72.145.44 为中国 ...