当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3009:Go Fishing

题目描述
This summer vacation, FZU-ACM members get together for training in the name of dream. Some of them like fishing. One afternoon M members of them go fishing together around the lake, they bring many buckets with them and put their fish in either one of N buckets, they can only remember the number of fish they catch, and the number of fish in every bucket. When the sun went down, everyone wants to take away the part belonging to him, so they need to split the N buckets into more buckets (here we can assume the number of buckets they own is unlimited). They want to minimize the times of split. They are so tired, so ask you to help them solve their puzzle. Each time they can only split the fish in one bucket into two buckets.
输入解释
The input consists of several test cases. The first line of each case contains two integers N,M.(1<=N,M<8)
N representing the number of buckets they put their fish in, and M representing the number of ACM members that go fishing.
The next line contains N integers representing the number of fish in each bucket.
The next line contains M integers representing the number of fish each ACM member catch.
输出解释
Output the minimal times they need to split the fish.
输入样例
2 3
1 2
1 1 1
4 3
2 4 4 3
5 5 3
输出样例
1
1
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3009

最后修改于 2020-10-25T22:59:09+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)