(hdu1085)Holding Bin-Laden Captive!(母函数,打表)
来源:互联网 发布:双色球合买软件 编辑:程序博客网 时间:2024/05/09 21:22
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1085
题意:分别给num1,num2,num3个1元,2元,5元硬币,求不能凑出来的最小值
分析:母函数
也是打表
#include <cstdio>#include <cmath>#include <cstring>#include <iostream>#include <string>#include <cctype>#include <vector>#include <queue>#include <algorithm>using namespace std;#define mem(a,n) memset(a,n,sizeof(a))#define pb push_back#define rep(i,a,n) for(int i=a; i<n; i++)typedef long long ll;typedef unsigned long long ull;const int mod=1e9+7;const double eps=1e-6;const int INF=0x3f3f3f3f;const int N=9e3+5;int ans[N],b[N];int main(){ int a,b,c; while(~scanf("%d%d%d",&a,&b,&c)) { if(!a && !b && !c) break; mem(ans,0); for(int i=0; i<=a; i++) ans[i]=1; for(int i=0; i<=a; i++) for(int j=0; j<=2*b; j+=2) if(ans[i]) ans[i+j]=1; for(int i=0; i<=a+2*b; i++) for(int j=0; j<=5*c; j+=5) if(ans[i]) ans[i+j]=1; for(int i=0; i<=a+2*b+5*c+1; i++) if(!ans[i]) { printf("%d\n",i); break; } } return 0;}
阅读全文
0 0
- (hdu1085)Holding Bin-Laden Captive!(母函数,打表)
- HDU1085 Holding Bin-Laden Captive!(母函数)
- HDU1085 Holding Bin-Laden Captive!(母函数)
- Holding Bin-Laden Captive!(hdu1085)——母函数
- HDU1085 Holding Bin-Laden Captive!,母函数
- HDU1085 Holding Bin-Laden Captive! 【母函数】
- 【HDU1085】Holding Bin-Laden Captive! 母函数
- Holding Bin-Laden Captive!(母函数)
- Holding Bin-Laden Captive!(母函数)
- Holding Bin-Laden Captive!(母函数)
- Holding Bin-Laden Captive!(母函数)
- Holding Bin-Laden Captive!(母函数)
- hdu1085 Holding Bin-Laden Captive! (多重背包)
- hdu1085-Holding Bin-Laden Captive!
- hdu1085 Holding Bin-Laden Captive!
- hdu1085 Holding Bin-Laden Captive!
- HDU1085 Holding Bin-Laden Captive!
- HDU1085 Holding Bin-Laden Captive!
- maven打包jar包问题
- Markdown 语法说明(简体中文版)
- 验证公众号网页授权凭证,php开发微信网页授权
- ROS 2 ardent apalone安装和使用说明
- QT控件大全 四十四 QColorPicker
- (hdu1085)Holding Bin-Laden Captive!(母函数,打表)
- nowcoder数圈圈 | 51nod1042 数字0-9的数量
- 检测设备是否支持Google Play服务
- vue动画之点击按钮往上渐渐显示出来
- oracle中的greatest 函数和 least函数
- 基础项目实战
- MongoDB数据建模小案例:朋友圈评论内容管理
- tensorflow电子书
- Facebook前高管批社交网络破坏社会,劝人们少用