日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

HDU - 1723 - Distribute Message

發布時間:2023/12/13 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 HDU - 1723 - Distribute Message 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

先上題目:

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    上代碼: 1 #include <cstdio> 2 #include <cstring> 3 #define MAX 32 4 #define LL long long 5 using namespace std; 6 7 LL dp[MAX]; 8 9 int main() 10 { 11 int n,m; 12 while(scanf("%d %d",&n,&m),(n+m)){ 13 memset(dp,0,sizeof(dp)); 14 dp[1]=1; 15 for(int i=1;i<=n;i++){ 16 for(int j=1;j<=m && i+j<=n;j++){ 17 dp[i+j]+=dp[i]; 18 } 19 } 20 printf("%I64d\n",dp[n]); 21 } 22 return 0; 23 } 1723

?

轉載于:https://www.cnblogs.com/sineatos/p/3574500.html

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的HDU - 1723 - Distribute Message的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。