Light OJ 1191 Bar Codes (DP)
来源:互联网 发布:张晶漫画家 知乎 编辑:程序博客网 时间:2024/06/05 12:53
解析:实质上和Light oj 1145是一个题 可以参考http://blog.csdn.net/qq_26572969/article/details/50654796
[code]:
#include<cstdio>#include<cstring>#include<cmath>#include<cstdlib>#include<algorithm>using namespace std;typedef long long LL;int n,k,m;LL dp[55],A[55];int main(){ int i,j,cas,T; scanf("%d",&cas); for(T = 1;T <= cas;T++){ scanf("%d%d%d",&n,&k,&m); memset(dp,0,sizeof(dp)); memset(A,0,sizeof(A)); dp[0] = 1; int l,r;LL sum; for(i = 1;i <= k;i++){ for(j = 0;j <= n;j++){ l = j+1,r = min(j+m+1,n+1); A[l] += dp[j]; A[r] -= dp[j]; } sum = 0; for(j = 0;j <= n;j++){ sum += A[j]; dp[j] = sum; A[j] = 0; } } printf("Case %d: %lld\n",T,dp[n]); } return 0;}
0 0
- Light OJ 1191 Bar Codes (DP)
- lightoj 1191 - Bar Codes 简单DP
- uva 10721 - Bar Codes(dp)
- UVA 10721Bar Codes(dp)
- UVa 10721 Bar Codes (DP)
- uva 10721 Bar Codes (DP)
- UVA10721 - Bar Codes(DP)
- Bar Codes - POJ 1173 dp
- light oj 1032 数位DP
- light OJ 1205 数位DP
- light OJ 1068 数位DP
- light oj 1140 数位dp
- light oj 1422,区间dp
- Light OJ 1231(背包dp)
- light oj 1068(数位dp)
- light oj 1422(区间dp)
- light oj 1025 区间dp
- light oj 1032(数位dp)
- Window 7 小常识集合
- 面试笔试杂项积累-leetcode 271-280
- Atitit. Ati IDE 开发平台的第一版规划
- atitit.跨语言实现备份mysql数据库 为sql文件特性 api 兼容性java c#.net php js
- 如何实现只收听一次sticky的广播,读取电池电量的值
- Light OJ 1191 Bar Codes (DP)
- SAE中的日志功能
- atitit.跨语言执行cmd cli api的原理及兼容性设计草案
- Leetcode 004 Median of Two Sorted Arrays
- 操作系统学习1
- HDU 4352 XHXJ's LIS(数位dp&状态压缩)
- JavaWeb项目中的绝对路径与相对路径问题
- Atitit.业务系统的新特性 开发平台 新特性的来源总结
- Atitit.mysql 5.0 5.5 5.6 5.7 新特性 新功能