spoj12943 Counting dp
来源:互联网 发布:列主元三角分解法C语言 编辑:程序博客网 时间:2024/06/03 17:59
题目链接
/********************************************************* file name: spoj12943.cpp author : kereo create time: 2015年02月24日 星期二 21时05分29秒*********************************************************/#include<iostream>#include<cstdio>#include<cstring>#include<queue>#include<set>#include<map>#include<vector>#include<stack>#include<cmath>#include<string>#include<algorithm>using namespace std;typedef long long ll;const int sigma_size=26;const int N=25;const int MAXN=100000+50;const int inf=0x3fffffff;const double eps=1e-8;const int mod=1000000000+7;#define L(x) (x<<1)#define R(x) (x<<1|1)#define PII pair<int, int>#define mk(x,y) make_pair((x),(y))int n,m;ll dp[N][MAXN];void init(){ memset(dp,0,sizeof(dp)); dp[0][0]=1; for(int i=1;i<N;i++){ for(int j=i;j<MAXN;j++){ dp[i][j]=dp[i-1][j-i]+dp[i][j-i]; if(dp[i][j]>=mod) dp[i][j]-=mod; } }}int main(){ init(); int T; scanf("%d",&T); while(T--){ scanf("%d%d",&n,&m); ll ans=0; for(int i=1;i<=m;i++){ ans+=dp[n][i]; if(ans>=mod) ans-=mod; } printf("%lld\n",ans); }return 0;}
0 0
- spoj12943 Counting dp
- HDU1396:Counting Triangles -DP
- Ant Counting(DP)
- UVALive5092Permutation Counting(DP)
- [DP]338. Counting Bits
- 338. Counting Bits(DP)
- Hdu 3664 Permutation Counting DP
- HDU 3664 Permutation Counting (DP)
- SPOJ 12943. Counting, dp ,巧妙
- [UVALive4864] Bit Counting && 数位DP
- 【DP】 HDOJ 2974 Counting heaps
- HDU 3664 Permutation Counting (DP)
- HDU 3664 Permutation Counting(DP)
- hdu-3664 Permutation Counting ,dp
- POJ 3046 Ant Counting dp
- hdu 1396 Counting Triangles (Dp)
- Sicily 1902 Counting Problem 简洁dp
- POJ2282:The Counting Problem(数位DP)
- UVA 11488-Hyper Prefix Sets(trie树+DFS)
- 2015新年好
- BZOJ 2502 上下界网络流
- 重头写一个v4l2的虚拟驱动_1
- J2EE框架搭建大集合
- spoj12943 Counting dp
- 重头写一个v4l2的虚拟驱动_2
- (hdu step 4.3.3)Sum It Up(从n个数中选出m个数让他们的和达到指定和targetSum,输出所有的合法序列)
- POJ 4052-Hrinity(KMP算法+AC自动机)
- android中对字符串的复数处理方法
- 辛星浅析Redis中的pub/sub功能
- Reduce对Pig作业性能的影响
- 重头写一个v4l2的虚拟驱动_3
- [WCF权限控制]从两个重要的概念谈起:Identity与Principal