Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the
You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the program is important so it is best to use an algorithm in the code which will not timeout
Power Leveling Problem Submissions Leaderboard Discussions fin In a certain Role Playing Game (RPG) character development is measured in discrete levels. A new character starts out, with zero experience poitns, at level o, and moves up in levels by earning sufficient experience points to be promoted. Characters gain experience points by embarking upon and completing quests and engaging in various activities. Assessment for a promotion is done at a base camp in the game, so characters must return to that base camp in order to see whether the amount of experience points that they have accumulated since their last visit are sufficient to grant them a promotion. On a single visit, a character is promoted by as many levels as their accumulated experience points warrant. Contest ends in 6 days Submissions: 17 Max Score: 25 Difficulty: Medium Rate This Challenge: More At Level 0, a character requires a experience points to attain Level 1. For each Level afterwards, the amount of experience required to promote a character to level 6+1 is always b more than it was at the previous level. (So, for example, it requires a+b experience points to be promoted from Level 1 to 2, and a + 2b experience points to be promoted from Level 2 to Level 3.) We are told that a character with experience points has just left the base camp and obtained all the promotions that it was entitled to up to that point, and then it makes a sequence of e excursions, with each excursion returning to the base camp to be promoted as far as possible, before embarking upon the next one. Given the sequence of points earned on each excursion: P1,...,Pe, we are asked to determine the highest level that the character would have attained after each excursion. Input Format Two lines of space separated integers: Line 1: a b x 6 Line 2: p_l ... p_e Constraints 1
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