Skill
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的更多相关文章
- 【转】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 ...
- 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>> ...
- 2018-4-5-cadence skill
skill 是 Cadence 提供的二次开发语言,可以做很多有用的二次开发. 开发参考手册:<algroskill><sklangref><sklanguser> ...
- 【技能意志矩阵-skill will matrix】工作中究竟是个人能力更重要,还是我们的积极性更能提高我们的业绩?
工作中究竟是个人能力更重要,还是我们的积极性更能提高我们的业绩? 我们可以通过建立“个人能力(即技能)”和“积极性(即意志)”的矩阵(skill will matrix),找到自己的象限,并根据指导意 ...
- get skill
Get Skill 2018-01-16 > 001 防止数组越界的一种方法 ]; array[n%] = value; > 002 超时机制 在等待某个事件或标志时,设定一定时限,时限到 ...
- 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 ...
- Rokid开发者社区skill之【历史上的今天】之简介+玩法+设计+实现+心得
Skill简介: 来源:好奇心.探索欲.趣味性: 资源:百度百科: 方式:实时获取,自动更新: 技能玩法: 想要进入历史上的今天这个skill,则对若琪说:若琪,打开历史上的今天. 想要了解某天的历史 ...
- Rokid开发者社区skill之【历史上的今天】
技能名称:历史上的今天 入口词:打开历史上的今天 语音交互:(有些是先写上) { "intents": [ { "intent": "PAUSE_HI ...
- 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 ...
随机推荐
- 用c#读取文件内容中文是乱码的解决方法:
用c#读取文件内容中文是乱码的解决方法: //方法1: StreamReader din = new StreamReader(@"C:\1.txt", System.Text.E ...
- 设置Tomcat根目录
找到Tomcat安装目录下的:conf\server.xml 在<Host />节点下加入: <Context path="/" docBase="my ...
- 【linux】如何查看和解压缩rpm文件内容
查看rpm文件中的内容 http://www.cyberciti.biz/faq/howto-list-find-files-in-rpm-package/ Use following syntax ...
- android学习笔记六——Spinner
注:参考http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0105/2264.html Spinner ==> Spinner ...
- DDD学习笔记二
参考:感谢博主的分享... http://www.cnblogs.com/netfocus/archive/2012/02/12/2347938.html DDD ==> 领域驱动设计(Doma ...
- svn 分支
网上的SVN分支的教程真的不好用,我这里自己写的,绝对靠谱: SVN的分支跟GIT的分支不一样,SVN的分支,包括文件夹的分支或者是文件的分支,都是重复复制文件的,步骤如下: 1.branch/tag ...
- ifconfig报错:SIOCSIFFLAGS: Operation not permitted
# insmod mt7601Usta.ko rtusb init rt2870 --->usbcore: registered new interface driver rt2870 # iw ...
- Linux常用命令记录
产用Linux命令 cat /proc/partitions //查看系统分区情况 fdisk -l /dev/sdb //查看磁盘物理存储 mount /dev/目录 /mnt/目录 //挂载文件 ...
- (C#) 调用执行批处理文件
Task: 在Windows的Service里面定时的调用执行一个批处理文件. private ApplicationOutput RunCommandOnPC(string executableP ...
- PLSQL_性能优化系列07_Oracle Parse Bind Variables解析绑定变量
2014-09-25 Created By BaoXinjian