先上题目:

Distribute Message

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1186    Accepted Submission(s): 547

Problem Description
The contest’s message distribution is a big thing in prepare. Assuming N students stand in a row, from the row-head start transmit message, each person can transmit message to behind M personals, and how many ways could row-tail get the message?
 
Input
Input may contain multiple test cases. Each case contains N and M in one line. (0<=M<N<=30)
When N=0 and M=0, terminates the input and this test case is not to be processed. 
 
Output
Output the ways of the Nth student get message.
 
Sample Input
4 1
4 2
0 0
 
Sample Output
1
3
Hint

4 1 : A->B->C->D

4 2 : A->B->C->D, A->C->D, A->B->D
 
  

 
 
上代码:
 
 #include <cstdio>
#include <cstring>
#define MAX 32
#define LL long long
using namespace std; LL dp[MAX]; int main()
{
int n,m;
while(scanf("%d %d",&n,&m),(n+m)){
memset(dp,,sizeof(dp));
dp[]=;
for(int i=;i<=n;i++){
for(int j=;j<=m && i+j<=n;j++){
dp[i+j]+=dp[i];
}
}
printf("%I64d\n",dp[n]);
}
return ;
}

1723


HDU - 1723 - Distribute Message的更多相关文章

  1. HDU 1723 Distribute Message DP

    The contest’s message distribution is a big thing in prepare. Assuming N students stand in a row, fr ...

  2. hdu 1509 Windows Message Queue

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1509 Windows Message Queue Description Message queue ...

  3. HDU 1509 Windows Message Queue(队列)

    题目链接 Problem Description Message queue is the basic fundamental of windows system. For each process, ...

  4. hdu 1509 Windows Message Queue (优先队列)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1509 题目大意:每一次输入都有序号和优先级,优先级小的先输出,优先级相同的话则序号小的先输出!第一次用 ...

  5. hdu 1509 Windows Message Queue (优先队列)

    Windows Message QueueTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  6. hdu 1723 DP/递推

    题意:有一队人(人数 ≥ 1),开头一个人要将消息传到末尾一个人那里,规定每次最多可以向后传n个人,问共有多少种传达方式. 这道题我刚拿到手没有想过 DP ,我觉得这样传消息其实很像 Fibonacc ...

  7. HDU题解索引

    HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsu ...

  8. mybatis中的resultMap与resultType、parameterMap与 parameterType的区别

    Map:映射:Type:Java类型 resultMap 与 resultType.parameterMap 与  parameterType的区别在面试的时候被问到的几率非常高,项目中出现了一个小b ...

  9. AMQP 0-9-1 Model Explained Why does the queue memory grow and shrink when publishing/consuming? AMQP和AMQP Protocol的是整体和部分的关系 RabbitMQ speaks multiple protocols.

    AMQP 0-9-1 Model Explained — RabbitMQ http://next.rabbitmq.com/tutorials/amqp-concepts.html AMQP 0-9 ...

随机推荐

  1. 心跳机制tcp keepalive的讨论、应用及“断网”、"断电"检测的C代码实现(Windows环境下)

    版权声明:本文为博主原创文章,转载时请务必注明本文地址, 禁止用于任何商业用途, 否则会用法律维权. https://blog.csdn.net/stpeace/article/details/441 ...

  2. C#操作INI文件(明天陪你看海)

    C#操作INI文件 在很多的程序中,我们都会看到有以.ini为后缀名的文件,这个文件可以很方便的对程序配置的一些信息进行设置和读取,比如说我们在做一个程序后台登陆的时候,需要自动登录或者是远程配置数据 ...

  3. C# 验证数字的正则表达式集

    验证数字的正则表达式集 博客分类: 正则 正则表达式 验证数字的正则表达式集 验证数字:^[0-9]*$ 验证n位的数字:^\d{n}$ 验证至少n位数字:^\d{n,}$ 验证m-n位的数字:^\d ...

  4. nyoj--990--蚂蚁感冒(模拟)(思维题)

    蚂蚁感冒 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 长100厘米的细长直杆子上有n只蚂蚁.它们的头有的朝左,有的朝右. 每只蚂蚁都只能沿着杆子向前爬,速度是1厘米/ ...

  5. bzoj2303

    并查集+数学 这道题网上好像有两种解法. 这位写的很可读:http://blog.csdn.net/unicornt_/article/details/51901225 然后看完大概就懂了做法,但是实 ...

  6. POJ 1010 题目翻译+题解

    题目实在是太难懂了,我翻译了一下... STAMPS Description Have you done any Philately lately? 你最近有没有集邮? You have been h ...

  7. TYVJ 1288 飘飘乎居士取能量块

    背景 9月21日,pink生日:9月22日,lina生日:9月23日,轮到到飘飘乎居士(狂欢吧,(^__^) 嘻嘻--). 描述 9月21日,今天是pink的生日,飘飘乎居士当然要去别人的领土大闹一番 ...

  8. Django html页面 'ascii' codec can't encode characters in position 8-10: ordinal not

    用Django开发的页面,之前用的是python3.X,后来又换成python2.X后各种报错,编码问题,于是在所有python文件开头加了编码:#coding=utf-8 但是后来发现,有些文件加了 ...

  9. java热部署

    最近使用java做项目,研究了一下热部署,能够提高工作效率. 需要准备的工具: 1.安装文件http://update.zeroturnaround.com/update-site/ 2.破解 下载破 ...

  10. angular2之组件通讯

    定义父组件,在父组件中以路由插座形式引入子组件,定义相关输入输出属性 可以在同一模块内部定义多个组件,将一个组件引入另一个组件中去:也可以该模块整体导出,将该模块导入到其他模块,这样此模块中的组件就能 ...