Codeforces Round #370 (Div. 2) D. Memory and Scores —— DP
来源:互联网 发布:stc89c52单片机驱动 编辑:程序博客网 时间:2024/06/01 21:47
题目链接: http://codeforces.com/contest/712/problem/D
题解:待定……
代码如下:
#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<cmath>#include<queue>#include<vector>#include<map>#include<string>#include<set>#define LL long long#define MAX(a,b) (a>b?a:b)#define MIN(a,b) (a<b?a:b)#define INF 0x7fffffff#define LNF ((1LL<<62)-1)#define mod 1000000007#define maxn 250000using namespace std;LL dp[105][maxn], sum[maxn];int main(){ int a,b,k,t; scanf("%d%d%d%d",&a,&b,&k,&t); dp[0][0] = 1; for(int i = 1; i<=t; i++) { for(int j = 0; j<maxn; j++) sum[j] = ( (j-1>=0?sum[j-1]:0) + dp[i-1][j] )%mod; for(int j = 0; j<maxn; j++) dp[i][j] = ( sum[j] - (j-2*k-1>=0?sum[j-2*k-1]:0) + mod )%mod; } for(int j = 0; j<maxn; j++) sum[j] = ( (j-1>=0?sum[j-1]:0) + dp[t][j] )%mod; LL ans = 0; for(int i = 0; i<=2*k*t; i++) ans += ( 1LL*dp[t][i] * (i+a-b-1>=0?sum[i+a-b-1]:0) )%mod, ans %= mod; printf("%lld\n",ans);}
0 0
- Codeforces Round #370 (Div. 2) D. Memory and Scores —— DP
- Codeforces Round #370 (Div. 2) D. Memory and Scores
- Codeforces Round #370 (Div. 2) D. Memory and Scores(DP)
- Codeforces Round #370 (Div. 2) D. Memory and Scores 动态规划
- Codeforces Round 370 (Div 2) D.Memory and Scores 【前缀和 DP】双人随机数值增减K A比B多的方案数
- codeforces 712D Memory and Scores (dp)
- 【Codeforces Round 370 (Div 2) D】【前缀和打标记】Memory and Scores 双人随机数值增减K A比B多的方案数
- 【DP or 生成函数】[CodeForces - 712D]Memory and Scores
- codeforces 712D. Memory and Scores(dp)
- Codeforces 712D Memory and Scores【dp+前缀和】
- Codeforces 712D Memory And Scores 前缀和+DP
- CodeForces 712D Memory and Scores
- 【26.87%】【codeforces 712D】Memory and Scores
- Codeforces Round #293 (Div. 2)D.Ilya and Escalator——概率dp
- Memory and Scores CodeForces
- 【DP】 Codeforces Round #293 (Div. 2) D. Ilya and Escalator
- Codeforces Round #358 (Div. 2) D. Alyona and Strings dp
- Codeforces Round #358 (Div. 2) D. Alyona and Strings dp
- 与spring结合的策略模式
- Designing Data-Intensive Applications(设计数据密集应用)- O'Reilly 2017 读书笔记
- jQuery 判断页面元素是否存在的代码
- python使用HTMLParser和BeautifulSoup解析网页
- 迭代器模式
- Codeforces Round #370 (Div. 2) D. Memory and Scores —— DP
- ViewDragHelper 深入解析
- 单例模式中为什么用枚举更好?
- 关于web前端学习
- 斯坦福 cs106A Assignment4
- CSU~1336: Interesting Calculator(spfa)
- SVN有冲突
- vs2015加载项目失败
- 字符、字节、字符集的小疑问