Mashmokh’s boss, Bimokh, didn’t like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh’s team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced programmer. Actually he is not a programmer at all. So he wasn’t able to solve them. That’s why he asked you to help him with these tasks. One of these tasks is the following.

A sequence of l integers b1, b2, …, bl (1 ≤ b1 ≤ b2 ≤ … ≤ bl ≤ n) is called good if each number divides (without a remainder) by the next number in the sequence. More formally for all i (1 ≤ i ≤ l - 1).

Given n and k find the number of good sequences of length k. As the answer can be rather large print it modulo 1000000007 (109 + 7).

Input

The first line of input contains two space-separated integers n, k (1 ≤ n, k ≤ 2000).

Output

Output a single integer — the number of good sequences of length k modulo 1000000007 (109 + 7).

Sample test(s)

Input

3 2

Output

5

Input

6 4

Output

39

Input

2 1

Output

2

Note

In the first sample the good sequences are: [1, 1], [2, 2], [3, 3], [1, 2], [1, 3].

dp[i][j] 长度为i,第i个数为j的方案数

/*************************************************************************
> File Name: CF240D.cpp
> Author: ALex
> Mail: zchao1995@gmail.com
> Created Time: 2015年03月17日 星期二 11时59分48秒
************************************************************************/ #include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std; const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const double eps = 1e-15;
typedef long long LL;
typedef pair <int, int> PLL; const int mod = 1000000007;
LL dp[2010][2010]; int main ()
{
int n, K;
while(~scanf("%d%d", &n, &K))
{
memset (dp, 0, sizeof(dp));
for (int i = 1; i <= n; ++i)
{
dp[1][i] = 1;
}
for (int i = 2; i <= K; ++i)
{
for (int j = 1; j <= n; ++j)
{
for (int k = 1; k * k <= j; ++k)
{
if (j % k == 0)
{
dp[i][j] += dp[i - 1][k] + (k * k == j ? 0 : dp[i - 1][j / k]);
dp[i][j] %= mod;
}
}
}
}
LL ans = 0;
for (int i = 1; i <= n; ++i)
{
ans += dp[K][i];
ans %= mod;
}
printf("%lld\n", ans);
}
return 0;
}

Codeforces Round #240 (Div. 1)B---Mashmokh and ACM(水dp)的更多相关文章

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

                                                 B. Mashmokh and ACM                                     ...

  2. Codeforces Round #240 (Div. 2)->A. Mashmokh and Lights

    A. Mashmokh and Lights time limit per test 1 second memory limit per test 256 megabytes input standa ...

  3. Codeforces Round #240 (Div. 2) C Mashmokh and Numbers

    , a2, ..., an such that his boss will score exactly k points. Also Mashmokh can't memorize too huge ...

  4. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  5. Codeforces Round #267 (Div. 2) C. George and Job(DP)补题

    Codeforces Round #267 (Div. 2) C. George and Job题目链接请点击~ The new ITone 6 has been released recently ...

  6. Codeforces Round #240 (Div. 2)(A -- D)

    点我看题目 A. Mashmokh and Lights time limit per test:1 secondmemory limit per test:256 megabytesinput:st ...

  7. Codeforces Round #240 (Div. 2) D

    , b2, ..., bl (1 ≤ b1 ≤ b2 ≤ ... ≤ bl ≤ n) is called good if each number divides (without a remainde ...

  8. Codeforces Round #396 (Div. 2) A B C D 水 trick dp 并查集

    A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 ...

  9. Codeforces Round #301 (Div. 2) D. Bad Luck Island 概率DP

    D. Bad Luck Island Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/540/pr ...

随机推荐

  1. 【置换群】CH Round #63 - OrzCC杯#2省选热身赛 exchange

    第一问置换群裸题. 第二问单独考虑某个循环,任意交换两个元素,稍微画一下就会发现,把该循环拆成了2个,剩下所需的交换次数减少了1,也就是说,第一步我们任意交换,都能够保证交换次数最少.于是一个循环的答 ...

  2. Java高级架构师(一)第18节:X-gen所需service、web层模板

    以X-gen的Controller为例: package $#modulePackge#.web; import org.springframework.beans.factory.annotatio ...

  3. Swift中TableViewCell便利构造器写法

    目前为止比较方便的一种方法,如果有更好的写法请通知我,谢谢!

  4. gitk图形界面中文乱码情况

    当打开gitk图形界面时,文件中的中文部分乱码了,这大部分是因为编码格式的问题,为了跟上时代的脚步,本人建议都是用utf-8编码. 为了方便,我将全局配置为utf-8编码: git config -- ...

  5. Oracle查询库中记录数大于2千万的所有表

    Oracle查询库中记录数大于2千万的所有表 假如当前用户拥有select any table权限,则可以使用下列sql语句: select table_name, num_rows from dba ...

  6. gin框架中间件解决跨域问题

    http://www.niu12.com/article/45// 初始化routerrouter := gin.New() router.Use(gin.Logger()) router.Use(g ...

  7. golang之bufio包的使用

    原文地址:http://www.niu12.com/article/38 github地址:https://github.com/ZQCard/go_api_practice // 参考:https: ...

  8. Laravel 5系列教程二:路由,视图,控制器工作流程

    免费视频教程地址https://laravist.com/series/laravel-5-basic 上一篇教程我们走了那么长的路,终于把Laravel安装好了,这一篇教程我们就要进入Laravel ...

  9. Yii2系列教程:安装及Hello World

    http://www.yiiframework.com/ 安装Yii2 打算从头开始,所以,连安装Yii2也稍微写一点吧.安装Yii2最好的方式就是使用composer: composer globa ...

  10. Oracle Database Link 的创建和使用小见

    假设:需要从数据库db_a通过db_link连接到db_b查询数据库b的部分相关信息 前提条件: 数据库a账户需要有创建dblink的权限,如果没有可以使用dba账户赋权限 grant CREATE ...