HBC24744三色二叉树[USACO 2010 Nov B]Math Practice题解

初见你 算法基础篇 41 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
One lovely afternoon, Bessie's friend Heidi was helping Bessie review for her upcoming math exam. Heidi presents two integers A (0

One lovely afternoon, Bessie's friend Heidi was helping Bessie review for her upcoming math exam. Heidi presents two integers A (0 <= A <= 45) and B (1 <= B <= 9) to Bessie who must respond with an integer E in the range 1..62. E is the smallest integer in that range that is strictly greater than A and also has B as the first digit of 2 raised to the E-th power. If there is no answer, Bessie responds with 0. Help Bessie correctly answer all of Heidi's questions by calculating her responses. By way of example, consider A=1 and B=6. Bessie might generate a table like this: E 2^E First digit of 2^E 2 4 4 3 8 8 4 16 1 5 32 3 6 64 6 <-- matches B Thus, E=6 is the proper answer. NOTE: The value of 2^44 does not fit in a normal 32-bit integer.

HBC24744三色二叉树[USACO 2010 Nov B]Math Practice题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC24744三色二叉树[USACO 2010 Nov B]Math Practice题解