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 ...
随机推荐
- [外文理解] DDD创始人Eric Vans:要实现DDD原始意图,必须CQRS+Event Sourcing架构。
原文:http://www.infoq.com/interviews/Technology-Influences-DDD# 要实现DDD(domain drive design 领域驱动设计)原始意 ...
- InfoQ中文站特供稿件:Rust编程语言的核心部件
本文为InfoQ中文站特供稿件.首发地址为: http://www.infoq.com/cn/articles/rust-core-components .如需转载.请与InfoQ中文站联系. 原文发 ...
- STL vector的介绍(1)
尝试下翻译STL里面的一些easy和算法.四级过了.六级刚考.顺便练练自己的英语水平.翻译的不好的地方请大神多多不吝赐教哈.方便我改正. 原来均来自:http://www.cplusplus.com/ ...
- Ubuntu下配置Tomcat以指定(非root)身份执行
My Blog:http://www.outflush.com/ 通常情况下.在配置Tomcat生产环境时,一般会配置Tomcat以特定的身份执行(非root).这样有利于提高安全性,防止站点被黑后的 ...
- linux 【第五篇】特殊权限及定时任务
特殊权限 [root@VM_141_154_centos ~]# ls -ld /tmp drwxrwxrwt. 8 root root 4096 Apr 5 08:11 /tmp /tmp/ 公共目 ...
- 手机阅读行业SWOT分析
上个星期,在公司内部的分享活动上给童鞋们分享了手机阅读行业现状,小伙伴儿们嗷嗷待哺的眼神促使我把PPT转换为博客里的文字和图片,再一次更加深入地进入手机阅读. 通过SWOT分析分析我们能够对手机阅读行 ...
- beego5---gosqlite安装
WindowsWindows下的安装也非常简单,只要到 SQLite3 的下载页面,下载 Windows 下的预编译包 DLL 的压缩包(sqlite-dll-win32-x86-XXX.zip),然 ...
- fscanf()函数详解【转】
本文转载自:http://blog.csdn.net/liangxanhai/article/details/8026496 以前解析有规律的文件的时候要么用正则表达式,要么就是傻傻的自己写程序来解析 ...
- CentOS 7下Keepalived + HAProxy 搭建配置详解
第一步:准备 1. 简介 本文搭建的是利用 Keepalived 实现 HAProxy 的热备方案,即两台主机上的 HAProxy 实例同时运行,其中全总较高的实例为 MASTER,MASTER出现异 ...
- 避免表单重复提交(js实现) (转)
<script language="javascript"> function submitForm(obj){ obj.disabl ...