师范大学 e: skyscrapers


#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef __int64 LL;
const LL mod = ;
LL cnm[][];
LL dp[][]; void prepare()
{
LL i,j;
for(i=;i<=;i++)
{
cnm[][i]=;
cnm[i][]=;
}
for(i=;i<=;i++)
{
for(j=;j<=i&&j<=;j++)
{
if(i==j) { cnm[i][j]=;continue;}
if(j==) { cnm[i][j]=i;continue;}
cnm[i][j]=(cnm[i-][j]+cnm[i-][j-])%mod;
}
}
dp[][]=;
for(i=;i<=;i++)
for(j=;j<=;j++)
dp[i][j]=(dp[i-][j-]+((i-)*dp[i-][j])%mod)%mod;
}
int main()
{
LL n,a,b,cur;
LL l,r;
prepare();
while(scanf("%I64d%I64d%I64d",&n,&a,&b)>)
{
if(n==&&a==&&b==)break;
l=a;r=n-b+;
for(cur=;l<=r;l++)
{
cur=( cur+((cnm[n-][l-]*dp[l-][a-])%mod)*dp[n-l][b-])%mod;
}
printf("%I64d\n",cur);
}
return ;
}
师范大学 e: skyscrapers的更多相关文章
- 应用留数定理计算实积分 $\dps{I(x)=\int_{-1}^1\frac{\rd t}{\sqrt{1-t^2}(t-x)}\ (|x|>1,x\in\bbR)}$ [华中师范大学2010年复变函数复试试题]
应用留数定理计算实积分 $\dps{I(x)=\int_{-1}^1\frac{\rd t}{\sqrt{1-t^2}(t-x)}\ (|x|>1,x\in\bbR)}$ [华中师范大学2010 ...
- 华东师范大学第十届ECNU Coder程序设计竞赛
华东师范大学第十届ECNU Coder程序设计竞赛 浮点数模运算 solution 转成整数然后取模. 时间复杂度:\(O(1)\) 数螃蟹 solution 找出公差出现次数最多的作为公差,然后找出 ...
- uoj #111. 【APIO2015】Jakarta Skyscrapers
#111. [APIO2015]Jakarta Skyscrapers 印尼首都雅加达市有 NN 座摩天楼,它们排列成一条直线,我们从左到右依次将它们编号为 00 到 N−1N−1.除了这 NN 座摩 ...
- Skyscrapers Aren’t Scalable
 Skyscrapers Aren't Scalable Michael Nygard WE oFTEn HEAR SoFTWARE EnginEERing CoMpAREd to building ...
- Skyscrapers Covered in Solar Pancels【太阳能电池板覆盖的摩天大楼】
Skyscrapers Covered in Solar Panels An office tower on Miller Stree in Manchester is completely cove ...
- 保研经验帖----江西师范大学 to 华中科技大学
呼,距离拿到华科cs的offer也有一段时间,有好几次准备动手写这篇经验帖,但就是理不清自己想表达什么,今早起来状态还不错,洗漱的时候思路居然通透了,哈哈哈~ 一.基本情况 先简单介绍笔者的一些基本情 ...
- 湖南师范大学计算机基础课网络教学平台 版本 V2.0(2017.9.18)
湖南师范大学计算机基础课网络教学平台 版本 V2.0(2017.9.18) 开发环境: 开发工具:VS2013,数据库:Sqlserver2012 开发语言:Asp.net MVC5 ,界面UI:jq ...
- Codeforces Round #622(Div 2)C2. Skyscrapers (hard version)
题目链接 : C2. Skyscrapers (hard version) 题目描述 : 与上一道题类似,只是数据范围变大, 5e5, 如果用我们原来的方法,铁定是超时的. 考察点 : 单调栈,贪心, ...
- Codeforces Round #622(Div 2) C1. Skyscrapers (easy version)
题目链接: C1. Skyscrapers (easy version) 题目描述: 有一行数,使得整个序列满足 先递增在递减(或者只递增,或者只递减) ,每个位置上的数可以改变,但是最大不能超过原来 ...
随机推荐
- Day 43数据库(Day1)
创建表. create table student( id int not null auto_increment PRIMARY key, name archar() not null, age i ...
- FFmpeg编写的代码
//初始化解封装 av_register_all(); avformat_network_init(); avcodec_register_all(); //封装文件的上下文 ...
- Good Bye 2017 C. New Year and Curling
Carol is currently curling. She has n disks each with radius r on the 2D plane. Initially she has al ...
- Aizu 2249Road Construction 单源最短路变形《挑战程序设计竞赛》模板题
King Mercer is the king of ACM kingdom. There are one capital and some cities in his kingdom. Amazin ...
- github本地分支合并到线上主分支
如果是在本地index-swiper分支上,已经写好了那么: 1,git add . //提交到本地缓冲区 2,git commit -m "project init ...
- 基于Zookeeper实现的分布式互斥锁 - InterProcessMutex
Curator是ZooKeeper的一个客户端框架,其中封装了分布式互斥锁的实现,最为常用的是InterProcessMutex,本文将对其进行代码剖析 简介 InterProcessMutex基于Z ...
- python学习笔记03-用户输入
name=Input(“your name”) 此处接受的数据类型为字符串 整数转字符串 str(123) 整数转字符串 int(“123”)
- 实验三:分别用for、while和do-while循环语句以及递归方法计算n!,并输出算式
一.用for循环计算n! package for_package; import java.util.*;//导入含有输入类的包 public class for_class { /** * @par ...
- android开发中的 Activity 与 Context 区别与联系
Context 是 Application /Activity /Service的基类 Intent(Context , Class); Activity中的上下文Context是随着活动的产生而产生 ...
- sql 时期格式整理
我们经常出于某种目的需要使用各种各样的日期格式,当然我们可以使用字符串操作来构造各种日期格式,但是有现成的函数为什么不用呢? SQL Server中文版的默认的日期字段datetime格式是yyyy- ...