Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description: Victor wrote a number nnn in base bbb on the whiteboard. He then converts every digit of nnn into base 10 and erases the
Description: Victor wrote a number nnn in base bbb on the whiteboard. He then converts every digit of nnn into base 10 and erases the original number: For example, BB529D in base 16 would become 11 11 5 2 9 13. However, this time, he forgot to add spaces in between to distinguish the digits, and now he has forgotten the original number. He now wonders how many possible values of nnn could have been the original number. Given the converted number as a string (sss) and the base (bbb), find out how many numbers could have been the original number, modulo 109+710^9+7109+7. Explanation: B -> 11 B -> 11 5 -> 5 2 -> 2 9 -> 9 D -> 13 BD925B -> 111152913 Some other numbers in base 16 that become 111152913 are: 111152913, B1152913, and B1F529D. Constraints: 1s1051 \leq |s| \leq 10^51s105 1b1091 \leq b \leq 10^91b109 Examples solve("111152913", 16) -> 16 solve("1111", 200) -> 7 solve("52319", 619) -> 13
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started