hdu 4045 2011北京赛区网络赛F 组合数+斯特林数 ***
斯特林数见百科
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#define LL long long
#define eps 1e-7
#define MOD 1000000007
using namespace std;
int c[][]={},stir2[][]={};
int main(){
for(int i=;i<=;i++){
c[i][]=c[i][i]=;
for(int j=;j<i;j++)
c[i][j]=(c[i-][j-]+c[i-][j])%MOD;
}
for(int i=;i<=;i++){
stir2[i][]=;
stir2[i][i]=;
for(int j=;j<i;j++)
stir2[i][j]=((LL)j*stir2[i-][j]+stir2[i-][j-])%MOD;
}
int n,r,k,m;
while(cin>>n>>r>>k>>m){
int sum=;
if(n-((r-)*k+)<){
cout<<<<endl;
continue;
}
for(int i=;i<=min(r,m);i++)
sum=(sum+stir2[r][i])%MOD;
cout<<((LL)c[n-((r-)*k+)+r+-][r]*sum)%MOD<<endl;
}
return ;
}
hdu 4045 2011北京赛区网络赛F 组合数+斯特林数 ***的更多相关文章
- hdu 4044 2011北京赛区网络赛E 树形dp ****
专题训练 #include<stdio.h> #include<iostream> #include<string.h> #include<algorithm ...
- hdu 4050 2011北京赛区网络赛K 概率dp ***
题目:给出1-n连续的方格,从0开始,每一个格子有4个状态,左右脚交替,向右跳,而且每一步的步长必须在给定的区间之内.当跳出n个格子或者没有格子可以跳的时候就结束了,求出游戏的期望步数 0:表示不能到 ...
- hdu 4049 2011北京赛区网络赛J 状压dp ***
cl少用在for循环里 #include<cstdio> #include<iostream> #include<algorithm> #include<cs ...
- hdu 4043 2011北京赛区网络赛D 概率+大数 **
推出公式为:P = A(2n,n)/(2^(2n)*n!) 但是不会大数,学完java再补
- hdu 4041 2011北京赛区网络赛B 搜索 ***
直接在字符串上搜索,注意逗号的处理 #include<cstdio> #include<iostream> #include<algorithm> #include ...
- hdu 4046 2011北京赛区网络赛G 线段树 ***
还带这么做的,卧槽,15分钟就被A了的题,居然没搞出来 若某位是1,则前两个为wb,这位就是w #include<cstdio> #include<cstring> #defi ...
- hdu 4036 2011成都赛区网络赛F 模拟 **
为了确保能到达终点,我们需要满足下面两个条件 1.能够到达所有山顶 2.能够在遇到苦土豆时速度大于他 二者的速度可以用能量守恒定律做,苦土豆的坐标可通过三角形相似性来做 #include<cst ...
- hdu 4026 2011上海赛区网络赛F TSP ****
没看过TSP,先mark //4838039 2011-10-27 23:04:15 Accepted 4026 2343MS 31044K 3143 B C++ Geners //状态压缩DP的TS ...
- HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛)
HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others) Memory Limit: ...
随机推荐
- ext grid 子表格
Ext.define('app.view.main.biz.customer.receipt.followup.FollowUpActionPanel', { extend: 'Ext.grid.Pa ...
- bootstrap按钮组
种类 -a, input , button 块级 btn-block 按钮组 btn-group btn-group-justified btn-group-vertical </div ...
- 强制QQ好友
tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=32595667&website=www.oicq ...
- Factor Combinations
Factor Combinations Problem: Numbers can be regarded as product of its factors. For example, 8 = 2 x ...
- 【leetcode】Convert Sorted Array to Binary Search Tree
Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending ord ...
- Unity3D研究院之拓展系统自带组件的Inspector视图
转自 http://www.xuanyusong.com/archives/3455 using UnityEngine; using System.Collections; using UnityE ...
- jquery 常用的备忘
1.table 取 tr 的 id值 <table class="table table-striped table-hover table-bordered" id=&q ...
- selenium WebDriver 操作高德地图
String URL="http://www.amap.com/"; WebDriver driver = new FirefoxDriver(profile); driver.g ...
- a byte of python (摘01)
a byte of python 第一章 介绍 Python 特色 简单.易学.免费.开源 高层语言.可移植性.解释性 面向对象.可扩展性.可嵌入性 丰富的库 第二章 安装Python http:// ...
- nyoj113_字符串替换
字符串替换 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述 编写一个程序实现将字符串中的所有"you"替换成"we" 输入 ...