Code Forces 543A Writing Code
题目描述
Programmers working on a large project have just received a task to write exactly mm lines of code. There are nn programmers working on a project, the ii -th of them makes exactly a_{i}ai bugs in every line of code that he writes.
Let's call a sequence of non-negative integers v_{1},v_{2},...,v_{n}v1,v2,...,vn a plan, if v_{1}+v_{2}+...+v_{n}=mv1+v2+...+vn=m . The programmers follow the plan like that: in the beginning the first programmer writes the first v_{1}v1 lines of the given task, then the second programmer writes v_{2}v2 more lines of the given task, and so on. In the end, the last programmer writes the remaining lines of the code. Let's call a plan good, if all the written lines of the task contain at most bb bugs in total.
Your task is to determine how many distinct good plans are there. As the number of plans can be large, print the remainder of this number modulo given positive integer modmod .
输入输出格式
输入格式:
The first line contains four integers nn , mm , bb , modmod ( 1<=n,m<=5001<=n,m<=500 , 0<=b<=5000<=b<=500 ; 1<=mod<=10^{9}+71<=mod<=109+7 ) — the number of programmers, the number of lines of code in the task, the maximum total number of bugs respectively and the modulo you should use when printing the answer.
The next line contains nn space-separated integers a_{1},a_{2},...,a_{n}a1,a2,...,an ( 0<=a_{i}<=5000<=ai<=500 ) — the number of bugs per line for each programmer.
输出格式:
Print a single integer — the answer to the problem modulo modmod .
Let us confirm that dp[i][j][k] means 1~i programmers finished j line of codes and they got k's bugs.
That is easy to know that dp[i][j][k]=dp[i-1][j-1][j-bug[i]]
Then we need a rounded array to pass the memory limited.
Code Forces 543A Writing Code的更多相关文章
- CodeForces 543A - Writing Code DP 完全背包
有n个程序,这n个程序运作产生m行代码,但是每个程序产生的BUG总和不能超过b, 给出每个程序产生的代码,每行会产生ai个BUG,问在总BUG不超过b的情况下, 我们有几种选择方法思路:看懂了题意之后 ...
- Codeforces 543A Writing Code
http://codeforces.com/problemset/problem/543/A 题目大意:n个人,一共要写m行程序,每个程序员每行出现的bug数为ai,要求整个程序出现的bug数不超过b ...
- 543A - Writing Code(二维动态规划)
题意:现在要写m行代码,总共有n个文件,现在给出第i个文件每行会出现v[i]个bug,问你在bug少于b的条件下有多少种安排 分析:定义dp[i][j][k],i个文件,用了j行代码,有k个bug 状 ...
- Codeforces Round #302 (Div. 2).C. Writing Code (dp)
C. Writing Code time limit per test 3 seconds memory limit per test 256 megabytes input standard inp ...
- 完全背包 Codeforces Round #302 (Div. 2) C Writing Code
题目传送门 /* 题意:n个程序员,每个人每行写a[i]个bug,现在写m行,最多出现b个bug,问可能的方案有几个 完全背包:dp[i][j][k] 表示i个人,j行,k个bug dp[0][0][ ...
- [CF543A]/[CF544C]Writing Code
[CF543A]/[CF544C]Writing Code 题目大意: 有\(n\)种物品,每种物品分别要\(c_i\)的代价,每个物品有\(1\)的体积,每个物品可以选多个,代价不能超过\(b\), ...
- (完全背包)Writing Code -- Codeforce 544C
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=99951#problem/C (zznu14) Writing Code Writin ...
- 思维题--code forces round# 551 div.2
思维题--code forces round# 551 div.2 题目 D. Serval and Rooted Tree time limit per test 2 seconds memory ...
- Codeforces Round #302 (Div. 2) C. Writing Code 简单dp
C. Writing Code Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/544/prob ...
随机推荐
- jdk1.8.0_45源码解读——HashMap的实现
jdk1.8.0_45源码解读——HashMap的实现 一.HashMap概述 HashMap是基于哈希表的Map接口实现的,此实现提供所有可选的映射操作.存储的是<key,value>对 ...
- [百度地图] 用于类似 DWZ UI 框架的 百度地图 功能封装类 [MultiZMap.js] 实例源码
MultiZMap 功能说明 MultiZMap.js 本类方法功能大多使用 prototype 原型 实现,它是 ZMap 的多加载版本,主要用于类似 DWZ 这个 多标签的 UI 的框架: 包含的 ...
- DDLog设置方法
CHENYILONG Blog DDLog设置方法 本文永久地址为http://www.cnblogs.com/ChenYilong/p/3984246.html,转载请注明出处. 201 ...
- 玩转Hook——Android权限管理功能探讨(一)
随着Android设备上的隐私安全问题越来越被公众重视,恶意软件对用户隐私,尤其是对电话.短信等私密信息的威胁日益突出,各大主流安全软件均推出了自己的隐私行为监控功能,在root情况下能有效防止恶意软 ...
- MacOS 下提示APP 损坏 无法安装 解决方法
sudo spctl --master-disable
- 关联查询resultMap使用规则总结——(十一)
resultType: 作用: 将查询结果按照sql列名pojo属性名一致性映射到pojo中. 场合: 常见一些明细记录的展示,比如用户购买商品明细,将关联查询信息全部展示在页面时,此时可直接使用re ...
- APP的CPU,内存,耗电,流量测试工具
APP的CPU,内存,耗电,流量测试工具下载地址,后续文章会介绍如何使用Emmagee.itest.gt APP应用的CPU,内存,耗电,流量调查 可和同类产品比较,使用GT等工具:CPU靠syste ...
- 关于iTerm2中颜色配置及快捷键使用技巧(亲测)
https://github.com/mbadolato/iTerm2-Color-Schemes http://chriskempson.com/projects/base16 (同事用的) 按照g ...
- Nuxt学习笔记
参考地址:https://zh.nuxtjs.org/guide/installation 官网 http://jspang.com/2018/02/26/nuxt/ 1.目录结构 2.Nuxt常用 ...
- Vue2.0 开发移动端音乐webApp 笔记
项目预览地址:http://ustbhuangyi.com/music/#/recommend 获取歌曲 url 地址方法升级:https://github.com/ustbhuangyi/vue-m ...