CodeForces 367E Sereja and Intervals
(109 + 7).
Two ways are considered distinct if there is such j(1 ≤ j ≤ n), that the j-th intervals in two corresponding sequences are not equal.
(109 + 7);
;
][MAX][MAX];
{
)
{
memset(dp,, dp[][][]=;
next=;
{
;k<=m;k++)
{
next=next^;
;i<=n;i++) ;j<=n;j++)
dp[next][i][j]=;
;i<=n;i++) ;j<=i;j++)
{
dp[next][i+][j]=(dp[next][i+][j]+dp[next^][i][j])%MOD;
dp[next][i+][j+]=(dp[next][i+][j+]+dp[next^][i][j])%MOD;
{
dp[next][i][j+]=(dp[next][i][j+]+dp[next^][i][j])%MOD;
dp[next][i][j]=(dp[next][i][j]+dp[next^][i][j])%MOD;
}
}
}
LL ans=dp[next][n][n]%MOD;
;i<=n;i++) ans=(ans*i)%MOD;
printf( }
}
;
42 }
CodeForces 367E Sereja and Intervals的更多相关文章
- CodeForces - 367E:Sereja and Intervals(组合数&&DP)
Sereja is interested in intervals of numbers, so he has prepared a problem about intervals for you. ...
- codeforces 314E Sereja and Squares
discription Sereja painted n points on the plane, point number i (1 ≤ i ≤ n) has coordinates (i, 0). ...
- Codeforces 425A Sereja and Swaps(暴力枚举)
题目链接:A. Sereja and Swaps 题意:给定一个序列,能够交换k次,问交换完后的子序列最大值的最大值是多少 思路:暴力枚举每一个区间,然后每一个区间[l,r]之内的值先存在优先队列内, ...
- codeforces 425C Sereja and Two Sequences(DP)
题意读了好久才读懂....不知道怎么翻译好~~请自便~~~ http://codeforces.com/problemset/problem/425/C 看懂之后纠结好久...不会做...仍然是看题解 ...
- codeforces B. Sereja and Stairs 解题报告
题目链接:http://codeforces.com/problemset/problem/381/B 题目意思:给定一个m个数的序列,需要从中组合出符合楼梯定义 a1 < a2 < .. ...
- codeforces A. Sereja and Bottles 解题报告
题目链接:http://codeforces.com/problemset/problem/315/A 题目意思:有n个soda bottles,随后给出这n个soda bottles的信息.已知第 ...
- Codeforces 380A - Sereja and Prefixes
原题地址:http://codeforces.com/problemset/problem/380/A 让期末考试整的好久没有写题, 放假之后由于生病也没怎么做,新年的第一场CF也不是那么在状态,只过 ...
- codeforces C. Sereja and Swaps
http://codeforces.com/contest/426/problem/C 题意:找出连续序列的和的最大值,可以允许交换k次任意位置的两个数. 思路:枚举区间,依次把区间内的比较小的数换成 ...
- CodeForces - 314C Sereja and Subsequences (树状数组+dp)
Sereja has a sequence that consists of n positive integers, a1, a2, ..., an. First Sereja took a pie ...
随机推荐
- bzoj 1867: [Noi1999]钉子和小球【dp】
设f[i][j]为掉到f[i][j]时的概率然后分情况随便转移一下就好 主要是要手写分数比较麻烦 #include<iostream> #include<cstdio> usi ...
- 构造 Codeforces Round #107 (Div. 2) B. Phone Numbers
题目传送门 /* 构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件WA好几次:( */ #include <cstdio> #include <algorithm> ...
- 258 Add Digits 各位相加
给一个非负整数 num,反复添加所有的数字,直到结果只有一个数字.例如:设定 num = 38,过程就像: 3 + 8 = 11, 1 + 1 = 2. 由于 2 只有1个数字,所以返回它.进阶:你可 ...
- 数据库恢复挂起解决办法【MSSQL】
新建查询输入如下代码运行 - -把test改成你需要修复的数据库名 USE master GO ALTER DATABASE test SET SINGLE_USER GO ALTER DATABAS ...
- win7升级到win10不能上网解决方法
不要相信360的网络诊断了,都是坑货,没有什么用.下面的方法亲测有效.如君不行,那估计是win10版本不一样,原因另寻. 1.以管理员身份运行CMD,输入netsh winsock reset. 2. ...
- C++(Typedef声明)
typedef 声明: 使用 typedef 为一个已有的类型取一个新的名字.下面是使用 typedef 定义一个新类型的语法: typedef type newname; 例如,下面的语句会告诉编译 ...
- IDEA打可执行jar包
流程: 1. File ->Project Structure -> Artifacts -> + -> JAR -> From modules with depende ...
- 【sqli-labs】 less61 GET -Challenge -Double Query -5 queries allowed -Variation4 (GET型 挑战 双查询 只允许5次查询 变化4)
http://192.168.136.128/sqli-labs-master/Less-61/?id=1' 单引号双括号闭合 192.168.136.128/sqli-labs-master/Les ...
- 6.15 分解IP地址
问题:将一个IP地址字段分解到列中,考虑下面列出的IP地址: 111.22.3.4 要得到如下所示的查询结果: +-----+----+---+---+| a | b | c | d |+--- ...
- MySql学习笔记(二) —— 正则表达式的使用
前面介绍利用一些关键字搭配相应的SQL语句进行数据库查找过滤,但随着过滤条件的复杂性的增加,where 子句本身的复杂性也会增加.这时我们就可以利用正则表达式来进行匹配查找. 1.基本字符匹配 ' o ...