Redian新闻
>
湖南纪委回应禁办生子祝寿宴:不接受可辞公职
avatar
湖南纪委回应禁办生子祝寿宴:不接受可辞公职# Joke - 肚皮舞运动
m*c
1
我在看bloomreach的opening的时候,看到这个puzzle,题目是wine testing。下面是
描述,链接在这个http://bloomreach.com/puzzles/
A large group of friends from the town of Nocillis visit the vineyards of
Apan to taste wines. The vineyards produce many fine wines and the friends
decide to buy as many as 3 bottles of wine each if they are available to
purchase. Unfortunately, the vineyards of Apan have a peculiar restriction
that they can not sell more than one bottle of the same wine. So the
vineyards come up with the following scheme: They ask each person to write
down a list of up to 10 wines that they enjoyed and would be happy buying.
With this information, please help the vineyards maximize the number of
wines that they can sell to the group of friends.
简单点说就是有很多的朋友想买酒,但是每种酒最多只能卖一次,一个人最多可以买三
种酒。题目给了每个人想买的酒的id,每个人最多想买10种。根据这个信息,问酒庄如
何可以卖出最多的酒。
我昨天想了想,觉得这个题目类似set cover或者set packing problem。解法的话就是
用greedy。但是总觉得不太好,不知道大家有没有更好的思路。
avatar
t*t
2
有网友说,做寿、生子是人生大事,这都不准办酒,是利用公权干涉私权。对此,省
纪委调研法规室这位负责人的答复是:“你是党和国家工作人员,就应当遵守党纪政纪
国法,正如网友说的,你接受不了,可以退党,可以辞去公职。如果因为这而要求退党
、辞职,我想不会有人挽留。”
avatar
k*4
3
Max fllow 算法?建立有向图。一边是人,一边是酒,人和酒之间加link,同时添加两
个辅助节点s d,s到每个人加link,每瓶酒到d之间加link,然后计算两个辅助节点s d
之间的max。flow
avatar
k*4
4
补充下, s到人之间link weight为3,其它为1。
avatar
m*c
5
max flow是个思路。但是我想了想,max flow里每一个edge有不同capacity,是要计算
在符合capacity的情况下最大的flow是多少。但是这个情况里,人和酒之间没有
capacity,而且是要计算能有多少酒卖出去,也就是能有多少flow经过酒的node。这也
和max flow不一样。

d

【在 k******4 的大作中提到】
: Max fllow 算法?建立有向图。一边是人,一边是酒,人和酒之间加link,同时添加两
: 个辅助节点s d,s到每个人加link,每瓶酒到d之间加link,然后计算两个辅助节点s d
: 之间的max。flow

avatar
k*4
6
人和酒的capacity为1?
avatar
m*c
7
不明白,我上wikipedia上看了看max flow,是从source到sink之间,所有node之间的
max flow。但是这个里面,人和人之间酒和酒之间不能有flow吧?

【在 k******4 的大作中提到】
: 人和酒的capacity为1?
avatar
k*4
8
我没说清楚,人和人之间还有酒和酒之间没有link,人和酒之间link的capacity为1,
酒和d之间也是1,但是s和人之间是3
avatar
l*n
9
这个办法好。

【在 k******4 的大作中提到】
: 我没说清楚,人和人之间还有酒和酒之间没有link,人和酒之间link的capacity为1,
: 酒和d之间也是1,但是s和人之间是3

avatar
b*e
10
这个是典型的匈牙利算法。放狗搜一下就知道了。

【在 m********c 的大作中提到】
: 我在看bloomreach的opening的时候,看到这个puzzle,题目是wine testing。下面是
: 描述,链接在这个http://bloomreach.com/puzzles/
: A large group of friends from the town of Nocillis visit the vineyards of
: Apan to taste wines. The vineyards produce many fine wines and the friends
: decide to buy as many as 3 bottles of wine each if they are available to
: purchase. Unfortunately, the vineyards of Apan have a peculiar restriction
: that they can not sell more than one bottle of the same wine. So the
: vineyards come up with the following scheme: They ask each person to write
: down a list of up to 10 wines that they enjoyed and would be happy buying.
: With this information, please help the vineyards maximize the number of

avatar
s*n
11
一共有多少种酒?

【在 m********c 的大作中提到】
: 我在看bloomreach的opening的时候,看到这个puzzle,题目是wine testing。下面是
: 描述,链接在这个http://bloomreach.com/puzzles/
: A large group of friends from the town of Nocillis visit the vineyards of
: Apan to taste wines. The vineyards produce many fine wines and the friends
: decide to buy as many as 3 bottles of wine each if they are available to
: purchase. Unfortunately, the vineyards of Apan have a peculiar restriction
: that they can not sell more than one bottle of the same wine. So the
: vineyards come up with the following scheme: They ask each person to write
: down a list of up to 10 wines that they enjoyed and would be happy buying.
: With this information, please help the vineyards maximize the number of

avatar
k*4
12
找最大匹配的话,还要剔除那些有人买了大于三瓶酒的情况。

【在 b***e 的大作中提到】
: 这个是典型的匈牙利算法。放狗搜一下就知道了。
avatar
m*c
13
嗯,我试试

【在 k******4 的大作中提到】
: 我没说清楚,人和人之间还有酒和酒之间没有link,人和酒之间link的capacity为1,
: 酒和d之间也是1,但是s和人之间是3

avatar
b*e
14
每个人3个点就行了。

【在 k******4 的大作中提到】
: 找最大匹配的话,还要剔除那些有人买了大于三瓶酒的情况。
avatar
k*4
15
说的对,我想错了。

每个人3个点就行了。

【在 b***e 的大作中提到】
: 每个人3个点就行了。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。