HDOJ1248(完全背包)
来源:互联网 发布:解数学题用什么软件 编辑:程序博客网 时间:2024/06/05 12:42
#include <iostream> #include <cstring>#include <string>#include <cstdio>#include <algorithm>#include <stack>#include <math.h>#include<iostream>#include <map>using namespace std;#define INF 0xfffff;//0x代表十六进制#define M 10int num[3] = { 150,200,350 };int dp[10050];int main(){int t;cin >> t;for (int i = 0; i < t; i++){memset(dp, 0, sizeof(dp));int n;cin >> n;for (int i = 0; i < 3; i++)for (int j = num[i]; j <= n; j++) dp[j] = max(dp[j], dp[j - num[i]] + num[i]); //与01背包不一样 是顺序cout << n - dp[n] << endl;}}
阅读全文
0 0
- HDOJ1248(完全背包)
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包!!
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 完全背包
- 余额宝资产规模破万亿元,用户数量超3亿
- 统计字符串再另一字符串中出现次数
- ofo获蚂蚁金服战略投资,国际化布局又进一步
- Android viewpager+photoview的使用
- 知情人士:乐视与阿斯顿马丁合作中止,或因乐视缺钱
- HDOJ1248(完全背包)
- 双lazytag线段树板子
- Trim a Binary Search Tree(leetcode)
- Angular4学习笔记(四)- 依赖注入
- JavaScript 数组
- Semi-supervised Segmentation of Optic Cup in Retinal Fundus
- 数字信号处理学习:基于CIC滤波器的正交检波
- FFMPEG录屏软件开发之YUV AAC合成MP4
- 183. Customers Who Never Order