hdu2079+母函数
来源:互联网 发布:linux 红色闪烁 编辑:程序博客网 时间:2024/06/07 22:43
传送门:
http://acm.hdu.edu.cn/showproblem.php?pid=2079
#include <bits/stdc++.h>using namespace std;struct node {int grades;int num;};int main(){int ncase;cin>>ncase;while(ncase--){int n,k;node res[10];cin>>n>>k;for(int i=1;i<=k;i++)cin>>res[i].grades>>res[i].num;int c1[45],c2[45];for(int i=0;i<=n;i++){c2[i]=0;c1[i]=0;}for(int i=0,t=0;i<=n&&t<=res[1].num;i+=res[1].grades,t++){c1[i]=1;} for(int i=2;i<=k;i++){for(int j=0;j<=n;j++)for(int m=0,t=0;m+j<=n&&t<=res[i].num;m+=res[i].grades,t++)c2[j+m]+=c1[j];for(int j=0;j<=n;j++){c1[j]=c2[j];c2[j]=0;}}cout<<c1[n]<<endl;}return 0;}
阅读全文
0 0
- hdu2079(母函数)
- hdu2079 母函数详解
- hdu2079+母函数
- HDU2079 ACM 母函数 解决
- hdu2079选课时间(动态规划&&母函数)
- HDU2079
- HDU2079
- HDU2079 选课时间(题目已修改,注意读题)【母函数】
- 【01背包/母函数】HDU2079选课时间(题目已修改,注意读题)【用背包求解方案数】
- hdu2079-选课时间
- HDU2079 选课时间
- hdu2079选课时间
- hdu2079选课时间(背包)
- HDU2079 选课时间(01背包+递推)
- 动态规划--背包计数--hdu2079选课时间
- hdu2079-选课时间(题目已修改,注意读题)
- hdu2079选课时间(题目已修改,注意读题)
- hdu2079选课时间(题目已修改,注意读题)
- java爬取国内飞机航班轨迹数据jsoup的探索
- POJ-2387 Til the Cows Come Home【最短路】
- 关于Hibernate三种状态
- 使用Android studio 遇到的问题及解决方法
- 座右铭
- hdu2079+母函数
- Java自动装箱拆箱注意点
- QT 使用QSettings 读写ini配置文件
- Error: org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException
- PCI设备扫描和资源分配
- centos7 docker容器报 docker Failed to get D-Bus connection 错误
- Docker安装在Centos上
- Codeforces Round #413 C. Fountains 二分
- 共享单车上的智能锁,做出来有多难?