HBC24762小y的旅行,图论,生成树,数据结构,并查集[USACO 2010 Ope B]Cow Pals题解

上官魅 算法基础篇 117 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
Bessie and all the other cows have an RFID serial number tag in their ear so FJ can mechanically tally them. Many cows have a 'cowpal' whose serial number is equal to the sum of the divisors of their own serial number. Some cows don't have a cowpal because no cow's serial number matches their divisor sum.Some cows have a superpal. Cows are superpals when their serial numbers make each of them a pal of the other. Cows that are superpals of themselves are shunned; do not consider them!

Bessie and all the other cows have an RFID serial number tag in their ear so FJ can mechanically tally them. Many cows have a 'cowpal' whose serial number is equal to the sum of the divisors (that are not the number itself) of their own serial number. Some cows don't have a cowpal because no cow's serial number matches their divisor sum. Some cows have a superpal. Cows are superpals when their serial numbers make each of them a pal of the other. Cows that are superpals of themselves are shunned; do not consider them! Given a serial number S (6 <= S <= 18,000), find the first cow with serial number at least S who has a super pal. By way of example, consider serial number 220 whose divisors are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, and 110. Their sum is 284. Similarly, the divisors of 284 are 1, 2, 4, 71, and 142. Their sum is 220.

HBC24762小y的旅行,图论,生成树,数据结构,并查集[USACO 2010 Ope B]Cow Pals题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC24762小y的旅行 图论 生成树 数据结构 并查集[USACO 2010 Ope B]Cow Pals题解