#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9+;
long long pre[][],temp[][];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=;i<=n;++i){
pre[][i]=;
temp[][i]=;
}
for(int i=;i<=m;++i)//当前位
for(int j=;j<=n;++j)//第i位以数字j结尾
for(int k=;k<=j;++k)//保证非降序
pre[i][j]=(pre[i][j]+pre[i-][k])%mod;//状态转移
for(int i=;i<=m;++i)//当前位
for(int j=;j<=n;++j)//第i位以数字j结尾
for(int k=j;k<=n;++k)//保证非升序
temp[i][j]=(temp[i][j]+temp[i-][k])%mod;//状态转移
long long ans=;
for(int i=;i<=n;++i)//枚举第二个数组以数字i作为结尾
for(int j=;j<=i;++j)//枚举第一个数组以数字j作为结尾,j<=i保证了第一个数组最大的都小于等于第二个数组最小的,所以整个数组全部满足小于等于关系
ans=(ans+(temp[m][i]*pre[m][j])%mod)%mod;//相乘得到答案
cout<<ans;
return ;
}

Educational Codeforces Round 80 (Rated for Div. 2)C(DP)的更多相关文章

  1. Educational Codeforces Round 80 (Rated for Div. 2)E(树状数组,模拟,思维)

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],mx[],a[],pos[],sum ...

  2. Educational Codeforces Round 80 (Rated for Div. 2)D(二分答案,状压检验)

    这题1<<M为255,可以logN二分答案后,N*M扫一遍表把N行数据转化为一个小于等于255的数字,再255^2检验答案(比扫一遍表复杂度低),复杂度约为N*M*logN #define ...

  3. Educational Codeforces Round 57 (Rated for Div. 2)D(动态规划)

    #include<bits/stdc++.h>using namespace std;char s[100007];long long a[100007];long long dp[100 ...

  4. Educational Codeforces Round 79 (Rated for Div. 2) Finished (A-D)

    如果最大值比剩余两个加起来的总和+1还大,就是NO,否则是YES #include<bits/stdc++.h> using namespace std; int main(){ int ...

  5. Educational Codeforces Round 82 (Rated for Div. 2)E(DP,序列自动机)

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],t[]; int n,m; ][]; ...

  6. Educational Codeforces Round 82 (Rated for Div. 2)D(模拟)

    从低位到高位枚举,当前位没有就去高位找到有的将其一步步拆分,当前位多余的合并到更高一位 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h&g ...

  7. Educational Codeforces Round 75 (Rated for Div. 2)D(二分)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;pair<int,int>a[20 ...

  8. Educational Codeforces Round 73 (Rated for Div. 2)D(DP,思维)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;long long a[300007],b[3 ...

  9. Educational Codeforces Round 72 (Rated for Div. 2)C(暴力)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;char s[200007];int a[20 ...

随机推荐

  1. AspxGridView 客户端点击获取对应的列值

    Html 内容: <dx:ASPxGridView ID="ASPxGridViewCluster" runat="server" Width=" ...

  2. AI: Uninformed search

    What is a search problem: A solution to a search problem is a sequence of actions (a path) from s0 t ...

  3. 修复ThinkPHP导出excel数字过大时显示为科学记数法

    修复ThinkPHP导出excel数字过大时显示为科学记数法,这种显示对于查看的用户来说是及其不友好的.所以,我们要使其转化为正常的数字串! 我在google 的过程中,查了一些资料.其中 1).// ...

  4. 【Unity|C#】基础篇(4)——函数参数类型(值参/ref/out/params)

    [学习资料] <C#图解教程>(第5章):https://www.cnblogs.com/moonache/p/7687551.html 电子书下载:https://pan.baidu.c ...

  5. 2.spring源码-BeanPostProcessor后置处理之ApplicationContextAwareProcessor,实现spring容器中某一个类的bean对象在初始化时需要得到Spring容器内容。

    需求:我们的需求是,在spring初始化完毕时,使我们自定义一个类Bird类可以得到spring容器内容. 实现步骤: 1.首先我们来看一下ApplicationContextAwareProcess ...

  6. Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) B Box

    #include<bits/stdc++.h> using namespace std; ]; ]; int main() { int total; cin>>total; w ...

  7. 删除表 (truncate 、delete 、drop)

    来源:http://www.cnblogs.com/dieyaxianju/p/7238936.html 删除表中内容分为三种情况. 1.删除表中所有数据,但保留表结构(可用以下两个语句): trun ...

  8. C语言-数组指针与指针数组

    1.思考 下面这些声明合法吗? int array[5]; int matrix[3][3]; int * pa = array; int * pm = matrix; 问题: array代表数组首元 ...

  9. python hashlib 详解

    1.概述 摘要算法简介 Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度固定 ...

  10. How to Create an OCM Response file to Apply a Patch in Silent Mode - opatch silent

    Windows Server 2019 打补丁时缺少Oracle Configuration Manager(OCM) 响应文件处理方式. 适用: Oracle Universal Installer ...