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

    
Class: VocaloidsAndSongs
Method: count
Parameters: int, int, int, int
Returns: int
Method signature: int count(int S, int gumi, int ia, int mayu)
(be sure your method is public)

Limits

    
Time limit (s): 2.000
Memory limit (MB): 256

Constraints

- S will be between 1 and 50, inclusive.
- gumi, ia and mayu will be each between 1 and S,
inclusive.

Examples

0)  
    
3
1
1
1
Returns: 6
In this case, there are 3 songs on the album. And Gumi, Ia, Mayu will each sing one song. There are 3*2*1 = 6 ways how to choose which Vocaloid sings which song.
1)  
    
3
3
1
1
Returns: 9
Gumi will sing all three songs. Ia and Mayu can each choose which one song they want to sing.
2)  
    
50
10
10
10
Returns: 0
It is not possible to record 50 songs if each Vocaloid can only sing 10 of them.
3)  
    
18
12
8
9
Returns: 81451692
 
4)  
    
50
25
25
25
Returns: 198591037

还有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)的更多相关文章

  1. H TC並沒有成為下一個摩托羅拉或諾基亞。

    關於2014年第四季度,H T C在三季度財報說明中提到,“年度旗艦H T CO ne(M 8)與中端機型H T C D esire系列在競爭日趨激烈的智能手機市場保持穩定的銷售,市占率有所提升,延續 ...

  2. TC(Total Commander)文件管理神器

    TC文件管理神器 Total Commander是一个会显著提高文件操作效率的工具,而文件操作是应用计算机最基本的功夫,也是伴随一生的操作.因此花一点时间学习,而会受益一世. Total Comman ...

  3. Linux TC基于CBQ队列的流量管理范例

    参考了TC的很多文档,自己也整理了一篇配置记录.在实际使用过程中效果还不错,在此分享给大家以备参考.环境:局域网规模不是很大40多台机器. NAT共享上网(内网:eth0 外网:eth2)CBQ是通过 ...

  4. Linux TC流量控制HOWTO中文版

    <本文摘自Linux的高级路由和流量控制HOWTO中文版 第9章节>网人郭工进行再次编译: 利用队列,我们可以控制数据发送的方式.记住我们只能对发送数据进行控制(或称为整形).其实,我们无 ...

  5. 蒟蒻修养之tc蓝名计划

    开一个新坑......(听说tc是智商高的人才能玩的QAQ显然我是被屠的... 1 [645DIV2]这个能说是裸模拟吗... 弃坑= =做了一些题感觉没必要放上来了= =等div1先吧....... ...

  6. 使用 TC 对LInux中vpn 上传下载进行限速(转)

    TC 无需安装,Linux 内核自带 例:将vpn IP地址段192.168.1.0/24 上传下载限速为 5M 将以下内容添加到/etc/ppp/ip-up文件exit 0上面. down=5Mbi ...

  7. 电影TS、TC、SCR、R5、BD、HD等版本是什么意思

    在很多电影下载网站的影片标题中我们都能看到,比如<刺杀希特勒BD版>.<游龙戏凤TS版>等,这些英文缩写都是什么意思呢?都代表什么画质?以下就是各个版本的具体含义: 1.CAM ...

  8. Linux下TC使用说明

    Linux下TC使用说明   一.TC原理介绍 Linux操作系统中的流量控制器TC(Traffic Control)用于Linux内核的流量控制,主要是通过在输出端口处建立一个队列来实现流量控制. ...

  9. TC Hash Filter

    Overview The u32 filter allows you to match on any bit field within a packet, so it is in some ways ...

随机推荐

  1. INTERSECT(交集)集合运算

    在集合论中,两个集合(记为集合A和B)的交集是由既属于A,也属于B的所有元素组成的集合. 在T-SQL 中,INTERSECT 集合运算对两个输入查询的结果集取其交集,只返回在两个查询结果集中都出现的 ...

  2. ZOJ 3228 Searching the String (AC自己主动机)

    题目链接:Searching the String 解析:给一个长串.给n个不同种类的短串.问分别在能重叠下或者不能重叠下短串在长串中出现的次数. 能重叠的已经是最简单的AC自己主动机模板题了. 不能 ...

  3. Hadoop之中的一个:Hadoop的安装部署

    说到Hadoop不得不说云计算了,我这里大概说说云计算的概念,事实上百度百科里都有,我仅仅是copy过来,好让我的这篇hadoop博客内容不显得那么单调.骨感.云计算近期今年炒的特别火,我也是个刚開始 ...

  4. Spring MVC @ResponseBody响应中文乱码

    问题:在前端通过get请求服务端返回String类型的服务时,会出现中文乱码问题 原因:由于spring默认对String类型的返回的编码采用的是 StringHttpMessageConverter ...

  5. 百度接口通过ip获取用户所在地

    /** * 百度接口      * 通过用户ip获取用户所在地      * @param userIp      * @return      */ public static String get ...

  6. Servlet的引入

    一.分析 此模式有问题: 1.jsp需要呼叫javabean StudentService stuService = new StudentServiceImpl(); List<Student ...

  7. Codeforces Round #419 (Div. 1) C. Karen and Supermarket 树形DP

    C. Karen and Supermarket     On the way home, Karen decided to stop by the supermarket to buy some g ...

  8. Hibernate 之 How

    分享自: http://blog.csdn.net/jnqqls/article/details/8242520 在上一篇文章Hibernate 之 Why? 中对Hibernate有了一个初步的了解 ...

  9. 在Eclipse中tomcat 内存配置

    修改1: 在Eclipse中下面Servers双击Tomcat Server... 然后点击General InformAtion 下的Open launch configuration: 会弹出Ed ...

  10. HDU2444 The Accomodation of Students —— 二分图最大匹配

    题目链接:https://vjudge.net/problem/HDU-2444 The Accomodation of Students Time Limit: 5000/1000 MS (Java ...