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 ...
随机推荐
- Android常见UI组件之ListView(二)——定制ListView
Android常见UI组件之ListView(二)--定制ListView 这一篇接上篇.展示ListView中选择多个项及实现筛选功能~ 1.在位于res/values目录下的strings.xml ...
- ZOJ 2859 二维线段树
思路:自己写的第二发二维线段树1A.哈哈,看来对二维的push操作比較了解了:可是还没遇到在两个线段树中同一时候进行push操作的,事实上这题我是想在x维和y维同一时候进行push操作的.可是想了好久 ...
- instancetype VS id
英文好的直接读下面链接的文章就好了: http://stackoverflow.com/questions/8972221/would-it-be-beneficial-to-begin-using- ...
- 图像处理之基础---很好的一个快速比较两副图片是否相同的code 可用于公安鉴别
转自Codeproject http://www.codeproject.com/dotnet/comparingimages.asp Public Enum CompareResult ciComp ...
- iPhone开发关于UDID和UUID的一些理解【转】
原文地址:http://blog.csdn.net/xunyn/article/details/13629071 一.UDID(Unique Device Identifier) UDID是Uniqu ...
- Tomcat最多支持并发多少用户?
当一个进程有 500 个线程在跑的话,那性能已经是很低很低了.Tomcat 默认配置的最大请求数是 150,也就是说同时支持 150 个并发,当然了,也可以将其改大.当某个应用拥有 250 个以上并发 ...
- 笔试题:求第M个到第N个素数之间全部素数
题目描写叙述 令Pi表示第i个素数. 现任给两个正整数M <= N <= 10000,请输出PM到PN的全部素数. 输入描写叙述: 输入在一行中给出M和N,其间以空格分隔. 输出描写叙述: ...
- YTU 1003: Redraiment的遭遇
1003: Redraiment的遭遇 时间限制: 1000 Sec 内存限制: 128 MB 提交: 198 解决: 71 题目描述 Redraiment的老家住在工业区,日耗电量非常大.是政府 ...
- Silverlight数据绑定之DataGrid
Silverlight数据绑定之DataGrid 时间:2011-08-03 01:59来源:网易博客 作者:Wilson. 点击:次 注:所有代码以C#为例 DataGrid绑定的数据对象: 1.D ...
- python 列表,元祖,字典
一 列表 1 列表的循环遍历 namesList = ['xiaoWang','xiaoZhang','xiaoHua'] for name in namesList: print(name) 结果 ...