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. ScrollView阻尼效果

    activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&qu ...

  2. /etc/profile与/etc/bashrc、交互式与非交互式、login与non-login shell的差别

    线上的memcached又挂了.仍然没有得到core文件. 排查原因,同事发现启动memcached的脚本存在可疑问题. 问题一:没有设置memcached工作文件夹,有可能core dump时没有工 ...

  3. java反射(2)+Class.forName( )

    在上一篇文章中说说java反射(1)我们已经了解了反射的基本概念以及它的原理,但是我们知道反射只能能用它来做些什么呢? 其实在我们很多已经很熟的框架中都有它的身影,例如Hibernate框架中的关联映 ...

  4. CAS和ABA

    1 CAS compare and swap的缩写,详见乐观锁和悲观锁. 2 ABA 就是说,我获取的旧值是A,然后被人修改成了B,但是又被人修改成了A,我就认为并没有修改,更新内存. 解决办法,给每 ...

  5. 生成 hibernate 映射文件和实体类

    创建web工程,使用Hibernate的时候,在工程里一个一个创建实体类太麻烦,浪费时间,现在教大家如何用MyEclipse自动生成Hibernate映射文件及实体类 方法/步骤   创建数据库,创建 ...

  6. 在Android用ZXing.jar识别二维码的精简版(简化了配置和代码)

            近期公司做了一款OTP令牌激活的产品,因为之前激活手机令牌须要输入非常多的激活信息才干进行激活. 经过一段使用后,发现易用性不是非常强,考虑假设添加二维码的的扫码功能岂不是大大添加了易 ...

  7. html页面内锚点定位及跳转方法总结

    1.最简单的方法是锚点用<a>标签,在href属性中写入DIV的id.如下: <!DOCTYPE html><html><head><style& ...

  8. UVA10600 ACM Contest and Blackout —— 次小生成树

    题目链接:https://vjudge.net/problem/UVA-10600 In order to prepare the “The First National ACM School Con ...

  9. YTU 1012: A MST Problem

    1012: A MST Problem 时间限制: 1 Sec  内存限制: 32 MB 提交: 7  解决: 4 题目描述 It is just a mining spanning tree ( 最 ...

  10. aliyun 日志服务(Log Service,Log)是针对日志场景的一站式服务

    日志服务(Log Service,Log)是针对日志场景的一站式服务,在阿里巴巴集团内部被广泛使用.用户无需开发就能快捷完成日志生命周期中采集.消费.投递以及查询功能. 日志服务当前提供如下功能 日志 ...