hdu1085
#include <iostream>
#include <cstring>
using namespace std;
int n[3],a[9000],b[9000],i,j,k,last,last2;
int v[3]={1,2,5};
int main()
{
while ((cin>>n[0]>>n[1]>>n[2])&&(n[0]!=0||n[1]!=0|n[2]!=0))
{
a[0]=1;
last=0;
for (i=0;i<=2;i++)
{
last2=last+n[i]*v[i];
memset(b,0,sizeof(int)*(last2+1));
for (j=0;j<=n[i];j++)
for (k=0;k<=last;k++)
b[k+j*v[i]]+=a[k];
memcpy(a,b,sizeof(int)*(last2+1));
last=last2;
}
for (i=0;i<=last;i++)
if (a[i]==0)
break;
cout<<i<<endl;
}
return 0;
}
hdu1085的更多相关文章
- HDU1085 多重背包
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Ja ...
- hdu1085 Holding Bin-Laden Captive!(母函数)
简单的母函数应用. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstrin ...
- HDU1085 Holding Bin-Laden Captive!
Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long t ...
- hdu1085 Holding Bin-Laden Captive!【生成函数】
列出生成函数的多项式之后暴力乘即可 #include<iostream> #include<cstdio> #include<cstring> using name ...
- [hdu1085]生成函数
题意:给a个1.b个2.c个5,求不能构成最小的数 思路: 先求1能构成的所有数,2能构成的所有数,5能构成的所有数,它们的方法数显然都是1,现在考虑把3者结合在一起,由于结果为和的形式,而又是循环加 ...
- A过的题目
1.TreeMap和TreeSet类:A - Language of FatMouse ZOJ1109B - For Fans of Statistics URAL 1613 C - Hardwood ...
- OJ题目分类
POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...
- ACM~排列组合&&hdu例子
排列组合是数学中的一个分支.在计算机编程方面也有非常多的应用,主要有排列公式和组合公式.错排公式.母函数.Catalan Number(卡特兰数)等. 一.有关组合数学的公式 1.排列公式 P(n ...
随机推荐
- Entity Framework 学习笔记(二)之数据模型 Model 使用过程
Entity Framework 数据模型 Model 创建的使用: 开发环境:VS2012 数据库:SQL Server 2008 Entity Framework 版本:6.12 下面是新建的 ...
- 创建HTML5/CSS3单页Web布局
1. [图片] 第1步:PhotoShop 2. [代码]第2步:index.html <!DOCTYPE html><!-- The new doctype -->< ...
- js 格式华货币
/*货币格式化*/ function formatMoney(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) { nu ...
- 仿联想商城laravel实战---6、自建配置文件和缓存(如何读取自己创建的配置文件的信息)
仿联想商城laravel实战---6.自建配置文件和缓存(如何读取自己创建的配置文件的信息) 一.总结 一句话总结: config()及相应的方法 1.前端插件选择好了,后端开发超级省力? 比如多图上 ...
- 英语发音规则---J字母
英语发音规则---J字母 一.总结 一句话总结: j只发[dʒ]音:jeep [dʒiːp] n. :jail [dʒeɪl] n. jeep [dʒiːp] n. 吉普车 jar [dʒɑː] n. ...
- IDEA 安装完码云插件,运行报“Cannot run program "xxx":CreateProcess error=2,系统找不到指定的文件”
错误:Cannot run program "E:\Program Files\Git\bin\git.exe":CreateProcess error=2,系统找不到指定的文件 ...
- 普林斯顿算法(1.3)并查集(union-find算法)——本质就是一个数 下面的子树代表了连在一起的点
转自:https://libhappy.com/2016/03/algs-1.3/ 假设在互联网中有两台计算机需要互相通信,那么该怎么确定它们之间是否已经连接起来还是需要架设新的线路连接这两台计算机. ...
- PS色调— —通道混合
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); Image=im ...
- android:layout_weight的真实含义/android:layout_gravity的条件
用layout_weight的时候,不要把宽度(或是高度,你想分配weight的那个)设成match_parent. android:layout_weight只适用于LinearLayout and ...
- Qt Create 4.6.2无法自动生成Android Kit
开发环境: OS,Microsoft Windows [Version 10.0.17134.523] Qt,5.11.1 Qt Creator,4.6.2 JDK,1.8.0_181 Android ...