TC 609DIV2(950)
Problem Statement |
|||||||||||||
| Vocaloids Gumi, Ia, and Mayu love singing. They decided to make an album composed of S songs. Each of the S songs must be sung by at least one of the three Vocaloids. It is allowed for some songs to be sung by any two, or even all three Vocaloids at the same time. The number of songs sang by Gumi, Ia, and Mayu must be gumi, ia, and mayu, respectively. They soon realized that there are many ways of making the album. Two albums are considered different if there is a song that is sung by a different set of Vocaloids. Let X be the number of possible albums. Since the number X can be quite large, compute and return the number (X modulo 1,000,000,007). |
|||||||||||||
Definition |
|||||||||||||
|
|||||||||||||
Limits |
|||||||||||||
|
|||||||||||||
Constraints |
|||||||||||||
| - | S will be between 1 and 50, inclusive. | ||||||||||||
| - |
gumi, ia and mayu will be each between 1 and S, inclusive. |
||||||||||||
Examples |
|||||||||||||
| 0) | |||||||||||||
|
|||||||||||||
| 1) | |||||||||||||
|
|||||||||||||
| 2) | |||||||||||||
|
|||||||||||||
| 3) | |||||||||||||
|
|||||||||||||
| 4) | |||||||||||||
|
|||||||||||||
还有950的。。确实比以前的1000简单点
数比较小了 开了四维的dp
dp[i][j][k][g]表示第i首歌曲时 三人分别唱了j,k,g次。
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<cmath>
using namespace std;
#define LL long long
#define mod 1000000007
LL dp[][][][];
class VocaloidsAndSongs
{
public :
int count(int S, int gumi, int ia, int mayu)
{
LL ans=;
int o[];
o[] = gumi;o[] =ia;o[] = mayu;
int i,j,k,g;
dp[][][][] = ;
dp[][][][] = ;
dp[][][][] = ;
dp[][][][] = ;
dp[][][][] = ;
dp[][][][] = ;
dp[][][][] = ;
for(i = ;i <= S ; i++)
for(j = ; j <= o[]+ ; j++)
for(k = ; k <= o[]+ ; k++)
for(g = ; g <= o[]+ ; g++)
{
// if(j+k+g+3>=i)
// {
dp[i][j][k][g] = (dp[i][j][k][g]+dp[i-][j-][k][g]+dp[i-][j][k-][g]+dp[i-][j][k][g-])%mod;
dp[i][j][k][g] = (dp[i][j][k][g]+dp[i-][j-][k-][g]+dp[i-][j][k-][g-]+dp[i-][j-][k][g-])%mod;
dp[i][j][k][g] = (dp[i][j][k][g]+dp[i-][j-][k-][g-])%mod;
//cout<<dp[i][j][k][g]<<" "<<i<<" "<<j<<" "<<k<<" "<<g<<endl;
// }
}
ans = dp[S][o[]+][o[]+][o[]+]%mod;
return ans;
}
};
TC 609DIV2(950)的更多相关文章
- H TC並沒有成為下一個摩托羅拉或諾基亞。
關於2014年第四季度,H T C在三季度財報說明中提到,“年度旗艦H T CO ne(M 8)與中端機型H T C D esire系列在競爭日趨激烈的智能手機市場保持穩定的銷售,市占率有所提升,延續 ...
- TC(Total Commander)文件管理神器
TC文件管理神器 Total Commander是一个会显著提高文件操作效率的工具,而文件操作是应用计算机最基本的功夫,也是伴随一生的操作.因此花一点时间学习,而会受益一世. Total Comman ...
- Linux TC基于CBQ队列的流量管理范例
参考了TC的很多文档,自己也整理了一篇配置记录.在实际使用过程中效果还不错,在此分享给大家以备参考.环境:局域网规模不是很大40多台机器. NAT共享上网(内网:eth0 外网:eth2)CBQ是通过 ...
- Linux TC流量控制HOWTO中文版
<本文摘自Linux的高级路由和流量控制HOWTO中文版 第9章节>网人郭工进行再次编译: 利用队列,我们可以控制数据发送的方式.记住我们只能对发送数据进行控制(或称为整形).其实,我们无 ...
- 蒟蒻修养之tc蓝名计划
开一个新坑......(听说tc是智商高的人才能玩的QAQ显然我是被屠的... 1 [645DIV2]这个能说是裸模拟吗... 弃坑= =做了一些题感觉没必要放上来了= =等div1先吧....... ...
- 使用 TC 对LInux中vpn 上传下载进行限速(转)
TC 无需安装,Linux 内核自带 例:将vpn IP地址段192.168.1.0/24 上传下载限速为 5M 将以下内容添加到/etc/ppp/ip-up文件exit 0上面. down=5Mbi ...
- 电影TS、TC、SCR、R5、BD、HD等版本是什么意思
在很多电影下载网站的影片标题中我们都能看到,比如<刺杀希特勒BD版>.<游龙戏凤TS版>等,这些英文缩写都是什么意思呢?都代表什么画质?以下就是各个版本的具体含义: 1.CAM ...
- Linux下TC使用说明
Linux下TC使用说明 一.TC原理介绍 Linux操作系统中的流量控制器TC(Traffic Control)用于Linux内核的流量控制,主要是通过在输出端口处建立一个队列来实现流量控制. ...
- TC Hash Filter
Overview The u32 filter allows you to match on any bit field within a packet, so it is in some ways ...
随机推荐
- java实现从报文中获取投保单号
java实现从报文中获取投保单号 投保单号正则表达式: String regex = "<proposalNo>([0-9]+)</proposalNo>[\\s\\ ...
- request.getAttribute()与request.setAttribute()
request.getAttribute()与request.setAttribute() request.getAttribute("nameOfObj")可得到JSP页面一表单 ...
- 块状元素的text-align对齐属性
能够为块状元素(div,h1,h2,form等)内容设置位置text-align:center,left;right;
- Eclipse导入项目: No projects are found to import
Eclipse导入项目: No projects are found to import 如果发导入工程import的时候,出现”No projects are found to import” 的 ...
- IIS7添加虚拟目录映射另一台服务器的共享文件夹
现状: 一台Windows Server2008 Web服务器 A,一台Windows Server2003 文件服务器 B,需要在A中IIS添加对B的Web访问 方法: 1.A中添加和B相同的账号, ...
- while语句字符串的基本操作
1,编码:对现在通用文字编码成计算机文字,便于储存,传递,交流. 最早的计算机编码是ACSII美国人创建的,包含英文字母,数字,以及特殊符号.总共是128个码位:2**7,因为计算机的底层只能识别:& ...
- 关于maven pom
1 maven pom.xml只是配置文件 构建的流程已经固化在maven中了,pom.xml只是对这个流程的配置.特别是插件,在不进行人工绑定的情况下,插件是对应固定的生命周期的,我们操作的时候是操 ...
- call function
1 call递归扩展变量 本质上仍然是变量扩展,等价于$(),只不过扩展的时候带了参数,$(call xxx)返回的是xxx扩展之后的值.参数依次赋值给$(1),$(2)......,但是参数要在赋值 ...
- 算法4-10:BST平衡二叉树的删除操作
偷懒方法 public void delete(Key key) { insert(key, null); } 这样的方法就是将key相应的值覆盖成null.当读取该键值的时候将会返回null. 这是 ...
- (21) java web的struts2框架的使用-Action实现的三种方式
上一篇介绍了struts使用的四个步骤. 其中在开发action的时候,可以有三种实现方式: 1,写一个类,继承与ActionSupport 2,写一个类,实现Action接口 3,写一个类,实现业务 ...