hdu2431 Counting problem
来源:互联网 发布:网络爱国事例 编辑:程序博客网 时间:2024/05/20 13:06
动态规划,最小表示法。
等价于整数n的划分方案数,每个数都要大于等于2。
至少有一个数。
#include<cstdio>#include<cstring>#include<string.h>using namespace std;const int maxn=505;const int m=1e6+7;int a[maxn];void init(){memset(a,0,sizeof(a));a[0]=1;for(int i=2;i<=maxn;i++){for(int j=i;j<=maxn;j++){a[j]+=a[j-i];if(a[j]>=m)a[j]-=m;}}}int main(){init();int casen,n;scanf("%d",&casen);while(casen--){scanf("%d",&n);printf("%d\n",a[n]);}return 0;}
阅读全文
0 0
- hdu2431 Counting problem
- pku2282 The Counting Problem
- Problem 19:Counting Sundays
- Sicily 1902. Counting Problem
- The Counting Problem poj2282
- Sicily 1902. Counting Problem
- TOJ 4112 Counting problem
- HDU 5085 Counting problem
- poj2282 The Counting Problem
- POJ2282 The Counting Problem:
- HDU1663The Counting Problem
- WOJ1254-The Counting Problem
- The Counting Problem UVA
- UVa Problem Solution: 10198 - Counting
- pku 2282 The Counting Problem
- poj 2282 The Counting Problem
- UVA 10516 Another Counting Problem
- POJ-2282-The Counting Problem
- 新浪微博架构
- timer的用法
- javascipt变量
- Qt的线程与异步
- JDK日志框架解读
- hdu2431 Counting problem
- 数字游戏
- 反射
- Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
- Qt的线程与异步
- 浅谈C语言与JAVA语言
- HDU 4614 Vases and Flowers (线段树[区间赋值+区间求和] + 二分)
- XML详解
- linux下开启和停止防火墙