c**z 发帖数: 669 | 1 这种matching题目应该使用什么算法,谢谢大家了!
we have to do now is implement a program
that assigns each product to a given customer while maximizing the total
suitability
of all products to all customers. so we need you to implement the matching
program.
The algorithm is:
• If the length of the product name is even, the base suitability
score (SS) is the
number of vowels in the customer’s name multiplied by 1.5.
• If the length of the product name is odd, the base SS is the number
of consonants
in the customer’s name multiplied by 1.
• If the length of the product name shares any common factors (besides
1) with the
length of the customer’s name, the SS is increased by 50% above the base SS.
Write a program that assigns products to sites in a way that maximizes the
total SS
over the set of customers.Each customer can only have one product and each
product
can only be offered to one customer. Your program should run on the command
line and
take as input two newline separated files, the first containing the names of
the
products and the second containing the names of the customers. The output
should be
the total SS and a matching between customers and products. You do not need
to worry
about malformed input, but you should certainly handle both upper and lower
case
names. | b********h 发帖数: 119 | 2 似乎可以用bipartite graph matching。
【在 c**z 的大作中提到】 : 这种matching题目应该使用什么算法,谢谢大家了! : we have to do now is implement a program : that assigns each product to a given customer while maximizing the total : suitability : of all products to all customers. so we need you to implement the matching : program. : The algorithm is: : • If the length of the product name is even, the base suitability : score (SS) is the : number of vowels in the customer’s name multiplied by 1.5.
| g***s 发帖数: 3811 | |
|