HBC252110教科书般的亵渎name group题解

凸凸曼凸凸 算法基础篇 28 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
In an alternate universe, every person has a three-letter name, and each letter must have a distinct reading. For example, "JWS" is a valid name, but "JW" is not because it has only two letters, and "JWJ" is not a valid name because two of the letters are same.That is, for the letters 'A', 'B' and 'C', each letter is contained in the names of at least two people.Now, you have a library of nnn unique letters, and each letter can be used aia_iai times, with the total number of uses of all letters guaranteed to be a multiple of 3. You can create sum/3sum/3sum/3 people names with them, where sumsumsum is the sum of all aia_iai. Please determine the maximum number of name groups you can create. If it is impossible to create sum/3sum/3sum/3 valid name groups, output -1.

In an alternate universe, every person has a three-letter name, and each letter must have a distinct reading. For example, "JWS" is a valid name, but "JW" is not because it has only two letters, and "JWJ" is not a valid name because two of the letters are same. If there are three people whose names have a magical characteristic, we call them a "name group". The characteristics of a name group are as follows: you can choose three different letters such that each letter is contained in the names of at least two people in the group. For example, if the first person is named "ACD", the second person is named "ABE", and the third person is named "BCF", then selecting "A" would include the first two people, selecting "C" would include the first and third people, and selecting "B" would include the second and third people. (Only the inclusion of a letter is necessary, not the position of the letter in the name.) That is, for the letters 'A', 'B' and 'C', each letter is contained in the names of at least two people. Note: each person can only be in one name group, and different people can have the same name. Now, you have a library of nnn unique letters, and each letter can be used aia_iai​ times, with the total number of uses of all letters guaranteed to be a multiple of 3. You can create sum/3sum/3sum/3 people names with them, where sumsumsum is the sum of all aia_iai​. Please determine the maximum number of name groups you can create. If it is impossible to create sum/3sum/3sum/3 valid name groups, output -1.

HBC252110教科书般的亵渎name group题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC252110教科书般的亵渎name group题解