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. 安装Android sdk 4.4(19)出现问题的解决方案

    刚更新了Android sdk 19,但是出现以下两个问题,浪费我2个小时的时间,现在将我遇到的问题和解决方法总结如下: 问题1:打开eclipse点更新后,出现This Android SDK re ...

  2. Debian安装记录

    Fedora着实让我伤心透了.前天和昨天搞了整整两天Fedora 20的安装,午睡也没有,晚上就睡了四个小时不到,几乎尝试了所有Fedora 20的桌面版本,全部出问题了!就因为我的笔记本显卡是ATI ...

  3. 开始学习IOS

    最好的学习方式就是动手. 对于有编程经验的程序员来说,学习另外一门技术最好的方式就是coding,虽然基础知识和IDE都不熟悉,但是在写代码的过程中,不断的解决问题,不断查找资料,不断感悟代码,一切都 ...

  4. CSS媒体查询(@media)

    @media only screen and (max-width: 500px) { .gridmenu { width:100%; } .gridmain { width:100%; } .gri ...

  5. Python 通过print_lol将数据保存到文件中

    1. 定义一个print_lol函数来控制列表的缩进和写入位置 import sys """this is a new fuction, which work for a ...

  6. Navicat(连接) -1高级设置

    高级设置 设置位置当创建一个新的连接,Navicat 将在设置位置创建一个子文件夹.大多数文件都保存在该子文件夹: Navicat 对象 服务器类型 扩展名 查询 全部 .sql 导出查询结果设置文件 ...

  7. MapReduce编程实现学习

    MapReduce主要包括两个阶段:一个是Map,一个是Reduce. 每一步都有key-value对作为输入和输出. Map阶段的key-value对的格式是由输入的格式决定的,如果是默认的Text ...

  8. PO_PO系列 - 采购单管理分析(案例)

    2014-07-01 Created By BaoXinjian

  9. POJ 3984 迷宫问题(BFS)

    迷宫问题 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, ...

  10. NeHe OpenGL教程 第十七课:2D图像文字

    转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...