CodeForces 415D Mashmokh and ACM
$dp$。
记$dp[i][j]$表示已经放了$i$个数字,并且第$i$个数字放了$j$的方案数。那么$dp[i][j] = \sum\limits_{k|j}^{} {dp[i - 1][k]}$。答案为$\sum\limits_{k=1}^{m} {dp[n][k]}$
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c = getchar();
x = ;
while(!isdigit(c)) c = getchar();
while(isdigit(c)) { x = x * + c - ''; c = getchar(); }
} const int maxn=;
LL dp[maxn][maxn],mod=1e9+;
int n,m; int main()
{
scanf("%d%d",&m,&n);
for(int i=;i<=m;i++) dp[][i]=;
for(int i=;i<=n;i++)
{
for(int j=;j<=m;j++)
{
for(int k=j;k<=m;k=k+j)
{
dp[i+][k]=(dp[i+][k]+dp[i][j])%mod;
}
}
}
LL ans=;
for(int i=;i<=m;i++) ans=(ans+dp[n][i])%mod;
cout<<ans<<endl;
return ;
}
CodeForces 415D Mashmokh and ACM的更多相关文章
- Codeforces 414B Mashmokh and ACM
http://codeforces.com/problemset/problem/414/B 题目大意: 题意:一个序列B1,B2...Bl如果是好的,必须满足Bi | Bi + 1(a | b 代表 ...
- codeforces D.Mashmokh and ACM
题意:给你n和k,然后找出b1, b2, ..., bl(1 ≤ b1 ≤ b2 ≤ ... ≤ bl ≤ n),并且对所有的bi+1%bi==0,问有多少这样的序列? 思路:dp[i][j] 表示长 ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 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 ...
- Codeforces Round #240 (Div. 1) B. Mashmokh and ACM DP
B. Mashmokh and ACM ...
- B. Mashmokh and ACM(dp)
http://codeforces.com/problemset/problem/414/B B. Mashmokh and ACM time limit per test 1 second memo ...
- codeforces 414D Mashmokh and Water Tanks
codeforces 414D Mashmokh and Water Tanks 题意 题解 \(a_i\):第 \(i\) 层的结点个数. \(b_i\):第 \(i\) 层初始有水的结点个数. 如 ...
- Mashmokh and ACM CodeForces - 414D (贪心)
大意: 给定n结点树, 有k桶水, p块钱, 初始可以任选不超过k个点(不能选根结点), 在每个点放一桶水, 然后开始游戏. 游戏每一轮开始时, 可以任选若干个节点关闭, 花费为关闭结点储存水的数量和 ...
- 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 ...
随机推荐
- avalonJS入门(一)
前端神器avalonJS入门(一) posted @ 2014-10-31 17:44 vajoy 阅读(1665) 评论(32) 编辑 收藏 avalonJS是司徒正美开发和维护的前端mvvm框 ...
- Apache JMeter--网站自动测试与性能测评
Apache JMeter--网站自动测试与性能测评 2013-02-28 15:48:05 标签:Jmeter From:http://bdql.iteye.com/blog/291987 出于学习 ...
- jsonp总结
由于“同源策略”的限制,ajax不能做跨域请求,jsonp是当下解决跨域请求最流行的方案,来个例子(index.html): <!doctype html> <html lang=& ...
- .NET MVC4 实训记录之七(实现资源的自主访问后续)
我们在上一篇中讨论了如何利用ModelMetadata实现国际化资源文件访问,但也留下了一些问题,即:如何利用ModelMetadata实现相同类型的属性信息的个性化资源显示.本人没有找到合适的方案, ...
- .NET MVC4 实训记录之二(扩展WebSecurity模型下的UserProfile表)
使用VS2013创建MVC4项目后,自动生成的代码中默认使用WebSecurity模型创建用户管理,生成以下数据库:
- 安装64位的oracle连接客户端
VS自带的WebServer只有32位的,你只能以32位运行,即使你的VS里面编译目标是64位的, 注意:发布到iis,可以以64位运行,你需要安装64位的oracle连接客户端.如果没有,你的程序必 ...
- gof设计模式回顾
gof23根据讲师学习笔记回顾: 1.gof:Gang of Four;叫grasp更具有针对性,解决具体的问题; ---------------------总共分为三大类: ---------创建型 ...
- C#有意思的算法题
年底了,特贡献一些C#有意思的算法题 2013年,即将要过去了.屌丝C#程序员们拿到了年终奖不?是不是又想蠢蠢欲动了?是不是想通过跳槽来为自己实现加薪的梦想?好吧,跳槽之前还是做点准备吧,准备好C ...
- ASP.NET MVC实现剪切板功能
前言 关于复制粘贴的功能,好像不用劳师动众的写后端代码,JS就可以,但正如大家所知道的,兼容性问题,当然这么通用的功能怎么可能没有一个通用的方案呢,于是便找到了一款jquery插件 jquery.cl ...
- SQLSERVER清空(Truncate)被外键引用的数据表
前言:我们知道SQLSERVER清空数据表有两种方式Delete和Truncate,当然两者的不同大家也都知道(不清楚的可以MSDN).不过这个错误“Cannot truncate table be ...