计算数的和的种类,母函数裸题

 #include<stdio.h>
#include<string.h>
int c1[],c2[],a,b; int main(){
int T;
while(scanf("%d",&T)!=EOF){
int n,k;
for(int q=;q<=T;q++){
scanf("%d%d",&n,&k);
int i,j,p;
memset(c1,,sizeof(c1));
c1[]=;int l=;
for(i=;i<=k;i++){
memset(c2,,sizeof(c2));
scanf("%d%d",&a,&b);
for(j=;j<=l;j++){
for(p=;p<=b;p++){
c2[j+p*a]+=c1[j];
}
}
l+=a*b;
for(j=;j<=l;j++)c1[j]+=c2[j];
}
printf("%d\n",c1[n]);
} }
return ;
}

hdu2079 选课时间(题目已修改,注意读题) 母函数的更多相关文章

  1. HDUOJ--2079选课时间(题目已修改,注意读题)

    选课时间(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  2. hdu 2079 选课时间(题目已修改,注意读题)

    http://acm.hdu.edu.cn/showproblem.php?pid=2079 背包 #include <cstdio> #include <cstring> # ...

  3. hdu 2079 选课时间(题目已改动,注意读题) (母函数)

    代码: #include<cstdio> #include<cstring> using namespace std; int main() { int t; scanf(&q ...

  4. 杭电ACM2076--夹角有多大(题目已修改,注意读题)

    杭电ACM2076--夹角有多大(题目已修改,注意读题) http://acm.hdu.edu.cn/showproblem.php?pid=2076 思路很简单.直接贴代码.过程分析有点耗时间. / ...

  5. HDOJ 2076 夹角有多大(题目已修改,注意读题)

    Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出 ...

  6. HDU 2076 夹角有多大(题目已修改,注意读题)

    Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出 ...

  7. HDU2079选课时间(母函数)

    母函数的简单应用http://acm.hdu.edu.cn/showproblem.php?pid=2079 介绍见另一篇随笔HDU1028Ignatius and the Princess III( ...

  8. HDOJ 2079 选课时间(母函数)

    选课时间(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  9. HDU 2079 选课时间(普通型 数量有限 母函数)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2079 选课时间(题目已修改,注意读题) Time Limit:1000MS     Memory Li ...

随机推荐

  1. Unity 4.x 资源打包

    using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; pu ...

  2. NotifyIcon实现托盘程序

    NotifyIcon 控件的常用属性属性:Icon类型:System.Drawing.Icon说明:将在系统任务栏中显示的图标.可以在设计时指定,也可在运行时动态指定.属性:Text类型:String ...

  3. 家里各台机器的php性能测试

    所用脚本: <?php $before = microtime(true); $list= array( "keya" => "the value a&quo ...

  4. 新概念 Lesson 4 Are you a teacher

    打招呼用语: Good morning, Good afternoon,Good evening Nice to meet you. How do you do? She is French. 她是法 ...

  5. UVA-10163 Storage Keepers (0-1背包)

    题目大意:有n个仓库,m个应聘者,每人对应一个能力值.一个人可以看多个仓库,一间仓库只能被一个人看.如果一个能力为p的人看k间仓库,那么安全系数为p/k,求出最大的最小安全系数,并且求出在此情况下所有 ...

  6. POJ服务器不能启动问题

    问题1: 启动tomcat时出现错误:tomcat Address already in use: JVM_Bind:80 按照网上的方法,查找占用80端口的进程:netstat -ano 任务管理器 ...

  7. spring boot 学习(二)spring boot 框架整合 thymeleaf

    spring boot 框架整合 thymeleaf spring boot 的官方文档中建议开发者使用模板引擎,避免使用 JSP.因为若一定要使用 JSP 将无法使用. 注意:本文主要参考学习了大神 ...

  8. bzoj3040

    题解: 模板题,地界特斯拉+堆优化 注意第一种建边 代码: #include<bits/stdc++.h> using namespace std; typedef long long l ...

  9. mac_os_x更新yosemite以后github客户端更新提示ca认证错误解决办法

    最近手贱更新了mac os yosemite的系统版本,更新以后发现部分软件无法使用,例如php 扩展的redis模块,mou,eclipse等等,甚是郁闷啊.对于图形化的软件还好说去官网更新一下新版 ...

  10. 如何在<textarea>标签中使用并解析HTML标签

    例如: <textarea name="intro" placeholder="请输入内容" maxlength="800">& ...