codeforces 526 c Om Nom and Candies
题意:
给出一个容量为c背包,两种物品的价值hr,hb和容量cr,cb,求装满背包能装的最大价值。
限制:
1
思路:
剩余系
设第一种物品有x个,第二种物品有y个,则有:
x*hr + y*hb
则有:
(c-y*hb) % hr = t
不难看出对于同一个剩余系t,最优值在两端。
所以求...
分类:
其他好文 时间:
2015-04-14 11:13:40
阅读次数:
230
题意:给你无穷多的A,B物品,现在你有承重C的背包,给你A,B物品的价值和重量,问你如何取使得价值最大。解题思路:很巧秒的枚举。解题代码: 1 // File Name: c.cpp 2 // Author: darkdream 3 // Created Time: 2015年04月05日 星期日 ...
分类:
其他好文 时间:
2015-04-05 21:54:15
阅读次数:
161
A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with...
分类:
其他好文 时间:
2015-04-05 14:40:31
阅读次数:
171
C. Om Nom and Candies无线超大背包问题 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include ...
分类:
其他好文 时间:
2015-04-05 10:28:10
阅读次数:
140
Who Gets the Most Candies?
Time Limit: 5000MS
Memory Limit: 131072KB
64bit IO Format: %I64d & %I64u
Submit Status
Description
N children are sitting in a circle to...
分类:
其他好文 时间:
2015-04-02 15:09:06
阅读次数:
179
Candy
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following requirements:
Each child must ha...
分类:
其他好文 时间:
2015-03-28 17:18:15
阅读次数:
150
https://leetcode.com/problems/candy/There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these child...
分类:
其他好文 时间:
2015-03-20 21:38:33
阅读次数:
148
Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class...
分类:
其他好文 时间:
2015-03-15 00:33:19
阅读次数:
127
DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a ...
分类:
其他好文 时间:
2015-03-14 10:59:21
阅读次数:
169