Skill

Yasser is an Egyptian coach; he will be organizing a training camp in Jordan. At the end of camp,
Yasser was quiet amazed that the participants solved all of the hard problems he had prepared; so he
decided to give them one last challenge:

Print the number of integers having N digits where the digits form a non decreasing sequence.

Input Specification
Input will start with T <= 100 number of test cases. Each test case consists of a single line having
integer N where 1 <= N <= 100000.

Output Specification
For each test case print on a separate line the number of valid sequences modulo 1000000007.

Sample Input
3
2
3
4

Sample Output
55
220
715

The Second Jordanian Collegiate Programming Contest
Princess Sumaya University for Technology (PSUT)
November 17th
, 2012

很好的一道数位DP。

#include <iostream>
#include <stdio.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <stack>
#include <math.h>
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
using namespace std ;
typedef long long LL ;
LL dp[][] ;
LL sum[] ;
const LL Mod= ;
int main(){
sum[]= ;
sum[]= ;
for(int i=;i<=;i++){
dp[][i]=-i ;
sum[]+=dp[][i] ;
}
for(int k=;k<=;k++){
LL sum_now= ;
for(int i=;i>=;i--){
dp[k][i]=sum_now+dp[k-][i] ;
if(dp[k][i]>=Mod)
dp[k][i]%=Mod ;
sum_now+=dp[k-][i] ;
if(sum_now>=Mod)
sum_now%=Mod ;
}
sum[k]= ;
for(int i=;i<=;i++){
sum[k]+=dp[k][i] ;
if(sum[k]>=Mod)
sum[k]%=Mod ;
}
}
int N ,T;
cin>>T ;
while(T--){
cin>>N ;
cout<<(sum[N]+Mod)%Mod<<endl ;
}
return ;
}

Skill的更多相关文章

  1. 【转】What is an SDET? Part 2 – Skill Matrix of SDET

    What is an SDET? Part 2 ---- Skill Matrix of SDET (Instead of naming it as part 2 of What is an SDET ...

  2. chfn,chsh,last,login,mail ,mesg ,talk,wall,write,nice ,pstree ,renice,skill ,expr ,reset,tset,compress ,lpd ,lpq ,lpr ,lprm,fdformat ,mformat ,mkdosf

    名称:chfn 使用权限:所有使用者 用法:shell>> chfn 说明:提供使用者更改个人资讯,用于finger and mail username 范例: shell>> ...

  3. 2018-4-5-cadence skill

    skill 是 Cadence 提供的二次开发语言,可以做很多有用的二次开发. 开发参考手册:<algroskill><sklangref><sklanguser> ...

  4. 【技能意志矩阵-skill will matrix】工作中究竟是个人能力更重要,还是我们的积极性更能提高我们的业绩?

    工作中究竟是个人能力更重要,还是我们的积极性更能提高我们的业绩? 我们可以通过建立“个人能力(即技能)”和“积极性(即意志)”的矩阵(skill will matrix),找到自己的象限,并根据指导意 ...

  5. get skill

    Get Skill 2018-01-16 > 001 防止数组越界的一种方法 ]; array[n%] = value; > 002 超时机制 在等待某个事件或标志时,设定一定时限,时限到 ...

  6. etymon word air aero aeri aer ag agreement walk joint trick skill chief forget out~1

      1● air 2● aero 3● aeri 4● aer 空气 充气       1● ag     做,代理做   =====>agency       1● agr 2● agri 3 ...

  7. Rokid开发者社区skill之【历史上的今天】之简介+玩法+设计+实现+心得

    Skill简介: 来源:好奇心.探索欲.趣味性: 资源:百度百科: 方式:实时获取,自动更新: 技能玩法: 想要进入历史上的今天这个skill,则对若琪说:若琪,打开历史上的今天. 想要了解某天的历史 ...

  8. Rokid开发者社区skill之【历史上的今天】

    技能名称:历史上的今天 入口词:打开历史上的今天 语音交互:(有些是先写上) { "intents": [ { "intent": "PAUSE_HI ...

  9. 40 Questions to test your skill in Python for Data Science

    Comes from: https://www.analyticsvidhya.com/blog/2017/05/questions-python-for-data-science/ Python i ...

随机推荐

  1. NAT,网络地址转换详解

    这个技术,是一个非常成熟的技术了,但是,为了将其弄得清楚点,体系点,也为了备忘,还是有必要在这里梳理一下! NAT:Network Address Translation. 这个主要是用在网络地址(I ...

  2. for循环内 执行$ajax(){}

    真是郁闷,在for 循环里添加了ajax异步传输之后,for循环是单线程处理,就是里面执行的是ajax,也不异步处理数据.而是执行完for循环的次数后,一起把ajax的数据处理掉. 解决办法.分开吧! ...

  3. 剑指offer系列56---连续子数组的最大和

    [题目]输入一个整型数组,数组里有正数也有负数.数组中一个或连续多个整数组成一个子数组. * 求所有子数组和的最大值. * [思路]连续求和数组元素.一旦得到的和小于0,就抛弃前面的数组,从当前值重写 ...

  4. 【Hadoop需要的Jar包】Hadoop编程-pom.xml文件

    JDK版本的要求 Hadoop 2.7 以及之后的版本,需要JDK 7: Hadoop 2.6 以及之前的版本,支持JDK 6: 对于Hadoop1.x.x版本,只需要引入1个jar: hadoop- ...

  5. 【mybatis】之批量添加

    mybatis批量添加xml <insert id="batchCreate"> INSERT INTO `roomer` (`order`,name,idCard,m ...

  6. makefile中的shell语法

    在Makefile中写shell代码有点诡异,和不同的shell语法不太一样,如果不了解,看Makefile会莫名其妙.下面总结了一些. 1:尽在Makefile文件的目标项冒号后的另起一行的代码才是 ...

  7. java数组初始化的三种方式

      //第一种 int[] is= new int[3]; is[0]=1; is[1]=2; is[2]=3; //第二种 int[] is2= {1,2,3}; //第三种 int[] is3= ...

  8. 最大熵的Java实现

    这是一个最大熵的简明Java实现,提供训练与预测接口.训练采用GIS训练算法,附带示例训练集.本文旨在介绍最大熵的原理.分类和实现,不涉及公式推导或其他训练算法,请放心食用. 最大熵理论 简介 最大熵 ...

  9. JAVA用户数据输入

    数据输入 首先需要导入扫描仪 然后声明扫描仪 输出输入提示 接收用户数据的数据 输出用户数据的数据 实例: import java.util.Scanner; //导入扫描仪 public class ...

  10. 1小时vpn coding让开发更简单 或https://www.imfreevpn.org/