题意 把数字T分成N个数的和,保证这N个数中最小的数大于P。求方案数目

另f[i][j]表示把i分成j个数的和的方案数

f[i][j]=f[i][j-1]+f[i-1][j-1]+f[i-2][j-1]+...f[0][j-1];

f[i-1][j]=f[i-1][j-1]+f[i-2][j-1]+...f[0][j-1];

两式做差 推出f[i][j]=f[i-1][j]+f[i][j-1];

那么ans=f[T-NP][N];

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
#define MAXN 500
LL f[MAXN][MAXN];
int N,T,P;
void init()
{
for (int i=;i<MAXN;i++) for (int j=;j<MAXN;j++) f[i][j]=;
for (int i=;i<=;i++)
f[][i]=;
for (int i=;i<=;i++)
for (int j=;j<=;j++)
f[i][j]=f[i-][j]+f[i][j-];
}
int main()
{
init();
int kase;
scanf("%d",&kase);
while (kase--)
{
scanf("%d%d%d",&N,&T,&P);
if (T-N*P<) {puts("");continue;}
else printf("%lld\n",f[T-N*P][N]);
}
return ;
}

UVA 10910 Marks Distribution的更多相关文章

  1. uva 10910(子集和问题)

    Marks Distribution Time limit: 3.000 seconds In an examination one student appeared in N subjects an ...

  2. uva 10910

    简单dp /************************************************************************* > Author: xlc2845 ...

  3. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  4. UVA - 11920 0 s, 1 s and ? Marks

    Description  0 s, 1 s and ? Marks  Given a string consisting of 0, 1 and ? only, change all the ? to ...

  5. 第八届河南省赛F.Distribution(水题)

    10411: F.Distribution Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 11  Solved: 8 [Submit][Status] ...

  6. UVa 12525 Boxes and Stones (dp 博弈)

    Boxes and Stones Paul and Carole like to play a game with S stones and B boxes numbered from 1 to B. ...

  7. 齐夫定律, Zipf's law,Zipfian distribution

    齐夫定律(英语:Zipf's law,IPA英语发音:/ˈzɪf/)是由哈佛大学的语言学家乔治·金斯利·齐夫(George Kingsley Zipf)于1949年发表的实验定律. 它可以表述为: 在 ...

  8. CloudSim4.0报错NoClassDefFoundError,Caused by: java.lang.ClassNotFoundException: org.apache.commons.math3.distribution.UniformRealDistribution

    今天下载了CloudSim 4.0的代码,运行其中自带的示例程序,结果有一部分运行错误: 原因是找不到org.apache.commons.math3.distribution.UniformReal ...

  9. Wishart distribution

    Introduction In statistics, the Wishart distribution is generalization to multiple dimensions of the ...

随机推荐

  1. PHP.18-图片等比例缩放

    图片等比例缩放 自定义函数ImageUpdateSize($pricname, $maxx, $maxy, $pre) 1.$pricname:被缩放的图片源(路径):2.$maxx,$maxy:缩放 ...

  2. 9 10mins的投票功能

    1.投票的原理 2.投票的数据结构设计 (1)准备工作 导入detail页面 配置静态文件 <link rel="stylesheet" href="../stat ...

  3. Android stadio 自定义debug release keystore

    1.添加siggnig name 随意,不过按我写的就可以了.设置完成之后,你的build.grade就会多出来一些: android { signingConfigs { signingConfig ...

  4. USACO Section2.3 Longest Prefix 解题报告 【icedream61】

    prefix解题报告------------------------------------------------------------------------------------------ ...

  5. WPF and Silverlight.ComboBox 如何通过 Binding IsDropDownOpen 实现下拉菜单展开

    In the WPF example the Popup and the ToggleButton (the arrow on the right) are bound with the proper ...

  6. Python 3基础教程10-全局变量和局部变量

    本文来讲讲全局变量和局部变量,前面学习了函数的基本使用,所以,这里就要注意变量的使用和访问权限. 试试下面的demo.py

  7. Python代码书写规范

    Python 编码规范 一 代码编排1 缩进.4个空格的缩进(编辑器都可以完成此功能),不要使用Tap,更不能混合使用Tap和空格.2 每行最大长度79,换行可以使用反斜杠,最好使用圆括号.换行点要在 ...

  8. Jmeter获取Cookie并传递到下一个线程---跨线程后cookie找不到了

    网上找了一堆文章没有一个是实际操作的,自己边试边查边摸索终于找到了一个全套的办法. 原创文章,转载请说明出处. 1.取得cookie 直接这样写就可以了${COOKIE_JSESSIONID},当然具 ...

  9. crmsh语法

    .查看配置信息 crm(live)# configure crm(live)configure# show node node1 node node2 property cib-bootstrap-o ...

  10. [ecmagent][redis学习][1初识redis] python操作redis

    #1 连接redis # 连接redis -- import redis -- 使用端口连接redis conn = redis.Redis(host=) -- 使用套接字连接 r = redis.R ...