HBC14623Piglet treasure hunt Series 3题解

惰性的成熟 算法基础篇 40 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Once there was a pig, which was very fond of treasure hunting.The last treasure hunt he bring back a full packageof diamonds, which too delight tofall asleep for a few days. But there are t

Once there was a pig, which was very fond of treasure hunting. The last treasure hunt he bring back a full package of diamonds, which too delight to fall asleep for a few days. But there are too many diamonds, and it has new troubles. It wants to get some diamonds sold for cash to buy its girlfriend pretty things. The price of a diamond is proportional to its weight, the heavier the diamond, the greatest price it worth. So he wants to know the accurate weight of some diamonds going to sell. Poor it only has an old balance, and the balance has no scale. You can only see which side of the balance is heavier, or both side have the same weight. It has N weights with different kilogram, and there are Ci for each kinds of weight. To simplify the problem, the kilogram of all weight and all the diamonds are integer. M diamonds is planning to be sold, the diamond merchant told the pig the ith diamond weighs wi kg, you know, businesses may misrepresent the weight, and maybe the actual weight of this diamond is not wi kg and the merchant chart it. So the pig needs to know the exact weight of each diamond. That is to say, you can puts any weights you want and the diamond need to be measure on both side of the balance and know which side is heavier in this state. If you can figure out the exact weight of this diamond through the results, then you output an “Yes”, or you output an “No” means you can’t sure the exact weigh of this diamond. It finds you smart to tell the answer.

HBC14623Piglet treasure hunt Series 3题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC14623Piglet treasure hunt Series 3题解